How to run Object Script trigger after HTTP POST trigger?

Posted by Rollbase User on 27-May-2012 09:16

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.

All Replies

Posted by Admin on 27-May-2012 10:26

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.

Posted by Admin on 27-May-2012 20:30

Works fine, but you have to use triggers debugger, not formula debugger.

Posted by Admin on 27-May-2012 22:31

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”);



Posted by Admin on 27-May-2012 23:18

Great glad you have a solution Claude and thanks for sharing it here



Regards,

Matt

Posted by Admin on 01-Jun-2012 19:25

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);

Posted by Admin on 01-Jun-2012 19:58

Thanks Claude!

This thread is closed