After business rules

Aside from before business rules, we also alluded to after business rules, which execute, as you might expect, after a database action is completed. Since before business rules execute before the record is saved to the database, any changes made to the current object are automatically saved to the database. Here's an example of that:

if (current.getValue('state') == '5') { 
current.setValue('active', 'false');
}

When using a "before" business rule, there's no need to call the update() method on the current object, because it's about to be saved to the database anyway! However, with "after" business rules, you'll need to call update() to submit the new data in the current object like so:

if (current.getValue('state') == '5') { 
current.setValue('active', 'false');
current.update();
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.119.114