- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi, I just wanna say that I am very new to Snow and I'm just getting to know the platform.
I got assigned the following task:
I would like the category and subcategory of incident to carry over to change records when a change is created from an incident record.
In the incident form, I have the change request related list in which I can submit a new change by clicking the New button. This button redirects me to sn_chg_model_ui_landing.do, not to the change_request.do page. How do I manage to carry over the cat and subcat from my incident? I know I can do it via params in the URL:
But it doesn't work when I select the model from the sn_chg_model_ui_landing.do. Any help?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @ernestogome
you can try with before Business rule to map the category and subcategory from incident to change but make sure the value of the category and subcategory of incident and also change is same.
if yes then try this way
Table: Change Request (change_request)
When: before
Insert: Checked
Condition: parent is not empty.
Script:
(function executeRule(current, previous /*null when async*/) {
var parentRec = current.parent.getRefRecord();
if (parentRec.isValidRecord() && parentRec.getTableName() == 'incident') {
// Copy the values
current.category = parentRec.category;
current.subcategory = parentRec.subcategory;
}
})(current, previous);
If this information proves useful, kindly mark it as helpful or accepted solution.
Thanks,
BK
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
see when you click New button in related and when new CHG form is opened if INC sysId is there in URL
if yes then extract that and then query it in display business rule on change_request and use that to get category subcategory and set it on CHG
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @ernestogome
you can try with before Business rule to map the category and subcategory from incident to change but make sure the value of the category and subcategory of incident and also change is same.
if yes then try this way
Table: Change Request (change_request)
When: before
Insert: Checked
Condition: parent is not empty.
Script:
(function executeRule(current, previous /*null when async*/) {
var parentRec = current.parent.getRefRecord();
if (parentRec.isValidRecord() && parentRec.getTableName() == 'incident') {
// Copy the values
current.category = parentRec.category;
current.subcategory = parentRec.subcategory;
}
})(current, previous);
If this information proves useful, kindly mark it as helpful or accepted solution.
Thanks,
BK
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
see when you click New button in related and when new CHG form is opened if INC sysId is there in URL
if yes then extract that and then query it in display business rule on change_request and use that to get category subcategory and set it on CHG
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @ernestogome ,
When you are creating a Change from the related list, and the Change is not yet saved, you can see the incident SysID in the URL at the end, which will become the parent of this Change.
You can write a Client script and extract Incident SysID using URL Parameters, and populate the Category and Subcategory.
You can check the below link to extract URL Parameters.
https://www.servicenow.com/community/service-management-articles/extracting-url-parameters-in-servic...
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi! How would I be able to extract the category from an client script? I understand how to retrieve the sysId from the URL, but how do i get the category? As far as I know, it's not posible to use GlideRecord on client scripts.
