- 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:36 PM
Hi Kiara,
It is nice your issue is solved.
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.
Regards,
Saurabh
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 12:36 PM
Maybe the records are being created, it's just that it's not linked to the record so it's not appearing in the related list?
Check sn_audit_advanced_observation.list to verify that the record is being created.
Maybe it has to do with the current.parent from your script, maybe the parent field is not populated on the ones you tested with?