Debuggig a codeless event handler

I am trying to use event handlers to perform operations after an entry is created in a specific table. My ultimate goal is to use event handlers create relations with other tables when an entry occurs.

I am setting it up like this:

and then I am simply using the print block to see

But nothing prints when I create an entry on the tips table. Am I doing it wrong?

Hi

how did you add the object? if you use the data view from the console then it doesn’t fire the event as i remember.

I was adding the entry directly in the data table, which didn’t work, but as soon as I used the console it worked, thanks.

1 Like

I am having an issue with a codeless event handler based on the update event. I want to run a handler when any object is updated in a specific table.

When I use the PUT method in the REST console to update an object, the event handler runs normally, I can get it to print stuff and do anything I need.

When I update an object using a Save Object with objectId, it does not run.
image

Is this normal?

If you update your object from cloud code (say in API service), other cloud code parts (an event handler for instance) will not be triggered. This is a limitation we have in place at the moment to prevent circular dependency that could drain all shared resources in Backendless cloud.

The only workaround is instead of using the “Save Object” block, do a rest request with the “HTTPS” block and make sure you are not using the cloud code API key.

Regards,
Mark

Got it. Like this using the REST API key for example?

image

Hello @Andreas_Marinopoulos

Yes, you can use HTTP/s block, but url in path shouldn’t use CloudCode API key

Regards,
Viktor

When creating an event handler based on an after table update, is it possible to retrieve the past field value?

Hello @Andreas_Marinopoulos

I do not think so, because when you update an object you just write new data to the database.
However, I think you can in the BeforeUpdate event handler load the object and put in into the Cache, then in the AfterUpdate event handler you can retrieve it and do whatever you need.

Does it make sense?

Regards, Vlad

1 Like