Best practices for updating records ("onUpdate"-tr

Posted by Rollbase User on 02-Apr-2013 04:03

When I create a record from a objectscript with the "rbv_api.createRecord"-function, this not run the "OnUpdate-triggers. My Expression-fields wil then not be updated. How can I, after this create, programatically update this record and my "Expression"-fields without edit and save the newly created record?

All Replies

Posted by Admin on 02-Apr-2013 15:00

CreateRecord API does not run triggers as explained in chapter 6 page 44. As for expression field - please submit support request to follow up.

Posted by Admin on 02-Apr-2013 15:12

Support-request is registered

Posted by Admin on 08-Apr-2013 11:25

Hi,



I just read the documentation on chapter 6 pages 43-44, it says otherwise:



- rbv_api.createRecord(objDefName, arr)

This method creates a new Object record.

....

Note: The Object Script API does invoke triggers on create, on update and on delete the same way as the Rollbase user interface does.



If i'm not mistaken, the createRecord API WILL invoke "After Create" triggers BUT, it WILL NOT invoke "After Update" triggers since it is a Create Operation.



An option if you want to auto-update a record After Create (inclusive of Expression fields) is:



1. On the object that the new record is created, add another object script that will run "After Create"



2. Place this code within it and save:

var arr = []; rbv_api.updateRecord("objDefName", "{!id}", arr);

- this will invoke "After Update" triggers and also populate Expression Fields values



From the documentation, guidelines when using createRecord and updateRecord::



Important: createRecord() and updateRecord() API obser

This thread is closed