- 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
@Community Alums
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2023 12:08 AM
Hi @Ankur Bawiskar
Yeah, I don't know the BR is not working. The classification is not auto-populating.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2023 08:04 PM
From the Engagement form, when 1 item in the Audit Task (sn_audit_control_test) was Closed Complete and the Control effectiveness is Ineffective, it will create a Control Test Issue (sn_grc_issue)
The only request is to auto-populate the 'Classification' field in the Control Test Issue form.
The configuration of the Name field is already in place. The classification only needs to be added to be auto-populated as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2023 10:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2023 10:03 PM - edited ‎11-08-2023 10:05 PM
Can you describe the business use case here.
This BR configured for update on sn_audit_control_test table but you are not using this table record in script.
Seems like you are trying to create an Issue record for each record update in table ( sn_audit_control_test) but this code is trying to create Issue record(s) for each entity record as there is no filter condition applied ( as below )
var entity = new GlideRecord('sn_grc_profile');
entity.query();
If you are actually trying to create multiple Issue records for each entity then change to order of GlideRecord table.
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();
}
This is just code update but i don't think your business use case is like that.
-Thanks
AshishKMishra
Please accept solution and mark helpful if it helps you.