Object Script

Object Script triggers run JavaScript, allowing the manipulation of multiple fields and records in one trigger via server-side Query API calls. To use this Trigger, enter a formula that returns no value, but invokes one or more Platform API calls (see Server-side API for more information). The following example modifies the amount field of an invoice record and prints a message displayed in the trigger debugger:

 rbv_api.setFieldValue("invoice", {!id}, "amount", 
   rbv_api.print("amount after discount: "+
   rbv_api.getFieldValue("invoice", {!id}, "amount"));

Infinite Blue recommends that only experienced Platform developers use Object Script triggers. See Debugging complex triggers for more information.

You can use all types of JavaScript in Object Script triggers including flow control constructions. To terminate the flow of Object Script trigger, as well as all subsequent triggers, and to rollback the entire transaction, you can throw a JavaScript exception:

if (something_is_terribly_wrong)
   throw "Cannot perform operation - aborted";