Query data when overriding update event handler

When the user makes an update service request I am overriding the afterUpdate method to update the row after the default logic.

However, the update I am trying to make requires more data than what is just in that row. Is there a way for me to gather more data from other rows (and possibly other tables) in order to do a calculation? It looks like the arguments that are passed into the method are just the row that was sent to the update service and the result row.

David,

If you’re going to update the same object, you may inadvertently cause a loop as your update in the “afterUpdate” handler will cause your handler to be invoked again. A better approach would be to create a “beforeHandler” where you can modify the incoming object and let the default update logic of Backendless handle the persistence.

Inside of your event handler you can use the SDK to make the calls into Backendless and gather any data you need (make sure to use the synchronous APIs).

Regards,
Mark

Thanks for the suggestion. Do you have any example documentation using the SDK to query data outside of the Asset that is part of the update?

The fact that you have an asset in the context has no bearing on what you can query. So it would be just a regular API call to fetch data from any other table.