In order to get rbv_api.getSharedValue(ReturnStatus), the book specify to : 1. Create GTTP GET or HTTP POST trigger. 2. Create Object Script trigger and configure it to run immediately after HTTP trigger. How do we configure the Object Script trigger to run after? I tried different ways, like running through rbv_api.runTrigger() or through Workflow Action, but without success.
I will check rbv_api.runTrigger().
Normally you invoke triggers on timing condition like "after update". Place Object Script trigger in sequence after HTTP POST, that should work. Use debugger.
Works fine, but you have to use triggers debugger, not formula debugger.
Finally, I have been successful in implementing it in the following way:
1) I created a Workflow Action which invoke a Object Script trigger.
(The first trigger could have been invoked in other ways like a "After update")
2) The Object Script trigger invoke the HTTP POST trigger using rbv_api.runTrigger() within a try... catch statement just in case an error is throwed.
3) The result is then retrieved and processed within the Object Script trigger using rbv_api.getSharedValue(ReturnStatus);
Great glad you have a solution Claude and thanks for sharing it here
Regards,
Matt
If you like you could replace the example in the chapter 10 of the book with this one:
Object trigger:
var code;
var body;
try {
rbv_api.runTrigger("Transaction", {!id}, "trigger_http_post");
code = rbv_api.getSharedValue("ReturnStatus");
body = rbv_api.getSharedValue("ReturnBody");
} catch(e) {
code = 999;
body = e.message;
rbv_api.println ("There was an error: "+body);
}
rbv_api.println ("code="+code+"\nbody="+body);
Thanks Claude!