- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2023 08:12 PM
What seems to be the reason why script is working in background script but not working in Business Rule?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2023 09:28 PM
how many records you want to insert sn_grc_issue? 1 or some other value?
try this
(function executeRule(current, previous /*null when async*/ ) {
var entity = new GlideRecord('sn_grc_profile');
entity.query();
while (entity.next()) {
var issue = new GlideRecord('sn_grc_issue');
issue.initialize();
issue.classification = 3;
issue.short_description = entity.name + ' has a control test failure';
issue.insert();
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2023 08:20 PM
Hi @Vengeful ,
Can u share what script is not working in BR?
Is the BR getting triggered?
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2023 08:22 PM
Hi @Vengeful ,
Share the fix script code and BR details.
-Thanks
Ashish
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2023 09:03 PM
Please share the script.
Remember you need to use current object in business rule for the table on which BR is written.
I suspect you might be copying the same background script. ensure you use correct GlideRecord objects.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2023 09:06 PM
Hi @AshishKM @Ankur Bawiskar @Danish Bhairag2