I am trying to save a file on the Before Create trigger on data table I have.
the request item has a property “logo” which will get saved as a file and I want to attach the returned URL to a property “companyLogo” of the RequestItem before its saved.
The saving part is working great, however I am unable to attach the URL to the request item before its being saved.
Are you sure the “if” check to see of logo is a type of object passes? Have you validated it? Perhaps with the print block and then checking in the logs?
Yes, the fact that the event handler is marked as non-blocking definitely explains why the property is not set. Backendless will not wait for the result of a non blocking event handler and will proceed with saving the object immediately after it fires off the event handler (ignoring what the handler returns).
Additionally, I looked at the logic in the afterCreate event handler and it could benefit from some optimizations. The logic makes 5 API calls, however, you could simplify it by using the DeepSave block and reduce the API calls to one.
Thanks once again for the guidance I ended up refactoring all the cloud code with a custom service. Everything is working as expected now and this is how I managed to accomplish it.
Good progress! You could optimize it even more by getting rid of the Add Object Relations and using the Depp Save block to save the root object in the Client table.
I was thinking of that but the “Client” which is the parent object in this case gets Saved at an earlier process from within the APP I didn’t know if deep save will work similarly tom a similar fashion as Upsert.
I have been trying to implement you suggestion with deep save on the parent object.
when I do that I can’t seem to be able to access the object properties of the children. I printed to log and this is my request object