Iam Creatin Incident Record it is a Parent Record to chage the category field automatically chage to child incident categroy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2022 11:02 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 01:12 AM
Hi,
So it looks like you want to change a category of a specific INC based of the value from the parent INC.
Why are you scripting this? You could just change/set the value directly as an admin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 03:51 AM
Hi There,
Please explain your query properly. You want to change the category of child incident as parent incident upon creation of child incident?
If yes, then you need to write a Business Rule on your child incident with below conditions:
When: before, insert.
advanced: true
script:
current.category = parent_incident.category;
If not, please clarify the use case properly and share the code in comments not the screenshot.
Please mark this as correct and helpful if it resolved the query or lead you in right direction.
Thanks,
Mohit Kaushik
Community Rising Star 2022
Mohit Kaushik
ServiceNow MVP (2023-2025)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 04:15 AM
Hii
Copy and paste the this tested code you will achieve your requirement for sure:-
Regards,
Imran Ahmad
Please Mark as Correct Answer:-
Please Mark as Helpful:-
(function executeRule(current, previous /*null when async*/) {
var child = new GlideRecord("incident");
child.addActiveQuery();
child.addQuery("parent_incident",current.sys_id);
child.query();
while(child.next()){
child.category = current.category;
child.update();
}
})(current, previous);
If Correct Mark as Correct:-
Please Mark as Helpful:-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 09:27 PM
its not working in line number 6 error