Business Rule Not Triggering When Value of String Field Changes to Required String
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 06:37 AM - edited 03-17-2025 08:02 AM
Version is Xanadu. I have a business rule on my x_1234_dlr_reemplo_third_party_admin_request table:
When Approval column value changed to be "Approved" this should trigger the business rule. However, I am not seeing proof of execution. This has the "Advanced" setting checked, so I also run a script:
(function executeRule(current, previous /*null when async*/ ) {
var fein = current.fein;
var randomNumber = Math.floor(Math.Random() * 90000000) + 10000000;
var pin = randomNumber.toString();
current.pin = pin;
current.update();
gs.info('Business Rule TPA_Approved_Generate_Pin. Pin: ' + pin + ". FEIN: " + fein);
var grEmployer = new GlideRecord('x_1234_dlr_reemplo_employer');
grEmployer.addQuery('fein', current.fein);
grEmployer.query();
if (grEmployer.next()) {
grEmployer.third_party_admin_request_pending = false; // Set to false
grEmployer.third_party_administrator_approved = true; // Set to true
grEmployer.pin = pin;
grEmployer.update();
}
})(current, previous);
My table, x_1234_dlr_reemplo_third_party_admin_request, also has a field named pin, which I am attempting to create a random 8 digit pin for, however, this NEVER gets updated after the record changes to an "Approved" state. I don't see any relevant logs that would indicate this even attempted to run.
The business rule should run whenever a record's "Approval" field changes to "Approved". I have also tried running "After" "Update" and that didn't work either.
Here is an example, viewing the list of the table records, changing the record to "Approved". Nothing happens:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 11:29 AM
Yep, I did click the Green Check that pops up when editing, and even refreshed, renavigated to page, and looked in my logs to see if the log message expected showed up, but did not see anything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 12:28 PM - edited 03-17-2025 12:30 PM
@ztb1997, when creating the after business rule, make sure to check the checkbox next to "Update." This ensures that your business rule will trigger when the field's value matches the specified condition
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.