After doing some more testing this morning, I suspected that bulkUpdate is the problem for why the event handler isn’t invoked and am working to fix this by changing the code to have an API call instead.
However I have also created a button to invoke the eventHandler with this logic:
When you make an API call from Cloud Code (i.e. API Service in your case), event handlers are not invoked. This is done to prevent circular invocations.
As for the value of the property, could you try disabling the following blocks and see what the logging shows:
Do you mean the same data in Request Item and Response?
It is a normal practice to add data from request to response.
In some cases, you don’t have request data but you have response. You can get info about request data from response
Thank you, I was trying to use the handler to trigger logic when a field in the database changed from false to true.
I thought that the request item would return the field’s state before the change ‘false’ and the response item would return the field’s state after the change ‘true’.
Now I know this is not the expected behaviour, is there a way for me to achieve this with something else?
You can use beforeUpdate event handler instead. This event handler receives changed record as an argument. So you will be able to retrieve from the database existing object, make your check and make API service call if it is required.