- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 08:54 AM
Can anyone help me in getting this as need to auto change status of Change Request form depends on Catalog Task status in servicenow
as off now when RITM is created then Catalog Task and Change Request are getting created via workflow.
@Ankur Bawiskar @Anil Lande @Sumalatha Y @BharathChintala @mattystern @priyasunku @asifnoor @Pradeep Sharma @SatyakiBose
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 12:45 PM
Hi,
Configure flow as below to update change status.
Thanks & Mark Answer Correct/Hit Thumbs Up. If my inputs help you to achieve what you are looking.
Sumalatha Y
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2023 02:44 AM
you need to decide which state value to set here -2 or -1
try this updated script
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord("change_request");
gr.addQuery("parent", current.request_item);
gr.query();
if (gr.next()) {
if(current.state == '2')
{
gr.state = '-2 || -1'; //choice Value For Scheduled or Implement
gs.info('sample enter 1');
}
else if (current.state == '3')
{
gr.state = '3'; //Choice Value for Closed
gs.info('sample 2');
}else if(current.state == '4')
{
gr.state = '4'; //Choice value for Cancelled
gs.info('sample 3');
}else if(current.state == '1')
{
gr.state = '-5'; //Choice value for open
gs.info('sample 4');
}
gr.update();
}
})(current, previous);
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 07:06 PM
then this BR you can have on sc_task
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("change_request");
gr.addQuery("parent", current.request_item);
gr.query();
if (gr.next()) {
gr.state = current.state; // ensure have you correct choice values between sc_task and change_request state field
gr.update();
}
})(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
03-09-2023 07:46 PM - edited 03-09-2023 07:48 PM
is it possible to write the BR to only particulat catalog item as it will not affect to other catalog items
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 08:32 PM
you can add condition in after update BR
current.request_item.cat_item.name == 'Your Catalog Item Name'
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
03-09-2023 08:55 PM
The state of Change Request is not changing when the state of Catalog Task is changing.
It's only changing when the Catalog Task state is Closed Complete Change Request State to Cancelled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2023 09:22 PM
I already told you need to have proper state value mapping between chg and sc_task
for example: In progress of sc_task should map with which state value of chg
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
