- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 12:07 PM
Hello Experts,
I am trying to trigger a record creation on Table B based on certain conditions on Table A via a Business Rule.
Written an AFTER (Insert , Update) Business Rule on Table : sn_audit_control_test
When : State = Closed Complete & Control Effectiveness = Ineffective
Below is the script :
(function executeRule(current, previous /*null when async*/) {
var desc = current.short_description;
var num = current.sys_id;
var eng = current.parent.sys_id;
var obsv = new GlideRecord('sn_audit_advanced_observation');
obsv.initialize();
obsv.short_description = desc;
obsv.audit_task = num;
obsv.engagement = eng;
obsv.insert();
gs.addInfoMessage(obsv.number + " ticket is created");
})(current, previous);
Went to the Control Test Form
Made these changes : State = Closed Complete & Control Effectiveness = Ineffective
Saved the Record. --> An Observation record got generated and displayed in the Related List on the Control Test Form.
But, when i did the same thing with another Control Record, i noticed no new Observation record was generated. I tried this with multiple Control Records, but nothing happened.
Can someone please help me with this requirement.
ThankYou !
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 12:20 PM
Place an info message in the beginning of BR, check if that is printing or not.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 12:12 PM
Can please explain better this "when i did the same thing with another Control Record"
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 12:18 PM
Hi Saurabh,
I meant, when i repeated below process for more control test records :
- Went to the Control Test Form
- Made these changes : State = Closed Complete & Control Effectiveness = Ineffective
- Saved the Record.
I was expecting records to generate on the Observation's table as per the Business Rule, but it did not happen.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 12:20 PM
Place an info message in the beginning of BR, check if that is printing or not.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 12:31 PM
Okay. I did that. Added "hello" info message.
And surprisingly, this time i made changes to 3 Control Test Forms and all of them created an Observation record respectively.
Just wondering, why the inconsistency !!
By just adding an Info Message, it is working !!
PFA