Business rule not working when inserting a record via REST API process
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2016 07:01 AM
Good morning. I need a script tweak...
I have a BEFORE Business Rule that is setting the value of Date field as a Time Stamp
Here's the script that runs when it meets this condition.
(function executeRule(current, previous /*null when async*/) {
var now = new GlideDateTime();
current.u_inshold_glide_date = now;
})(current, previous);
This is working great when I update a record.
But, now we're inserting new records in our nightly process and I have another rule that is setting the "Insurance Hold?" to true on "Insert". That worked over night but it did not set the "Insurance Hold Date" as it does when I update. Then I went in to update and nothing changed.
Here's my question. If I just make "Insert = True" on the business rule above, and change the condition to IS True rather than "CHANGES To True" will it fix my issue?
The purpose of this is to put newly Inserted vendors on Insurance hold until someone has an opportunity to review their insurance documents.
What do you suggest?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 07:33 AM
We ended up with the following business rule and its working.
When = Before
Update = True
Order = 100
Condition = Boolean Field Changes
(function executeRule(current, previous /*null when async*/) {
var now = new GlideDateTime();
if(current.u_boolean_field == false && previous.u_boolean_field == true){
current.u_inactive_glide_date = now;
}
})(current, previous);
I forgot about this post. Maybe I get the right answer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 08:19 AM
Mine was solved due to ACL: debug data lookup inserted via REST