Business Rule Script Help plz..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 11:28 AM
Hello everyone,
How do I script in Business rule to achieve below requirement.
When "Create Security Incident" button (existing UI Action) is clicked within an Incident record, the Description field contents for the Incident should be copied to the Description field within the resulting Security Incident.
Please help. TIA

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 11:55 AM
Hi there,
Why would this be a Business Rule requirement? Can't you just change the UI Action?
Please provide a bit more context to your question.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 01:37 PM
Hello Mark,
How do I approach to script this in a UI Action? Can you help? TIA

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 09:34 PM
Most lickely there's some code in the UI Action to create the Security Incident, or through a Script Include. So you can expand that. Instead of coding almost the same in a separate Business Rule.
If you need help on that, share details of your setup.
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 08:42 AM - edited 10-08-2023 10:08 AM
Hi,
You can modify the OOB script include named "SecurityIncidentUtils"
add:
gr.setValue('description', currentIncident.description);
after line 440 there. However, I would not recommend that you modify the OOB UI Action or the OOB Script include.
Instead, create a Business rule that is defined on the 'sn_si_incident' table, runs Before with an Order value greater than 100, Runs on Insert, Condition with 'Description', 'is empty', and a 2nd condition "Initiated from", "is not empty". Set Advanced checked and script logic as follows:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var inc = new GlideRecord('incident');
inc.addQuery('sys_id', current.initiated_from.toString());
inc.query();
if (inc.next()) {
current.description = inc.description;
gs.info("setSecurityIncidentDesc: Using description from " + inc.number + " for: " + current.number);
}
})(current, previous);