- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 07:38 AM
I have a catalog item to increase Priority of any other requests. I have a reference variable to sc_req_item. What I need here is once the request is approved priority of the selected Item (item on the variable) should go 1 level up. So if request is Medium, it should be set to High. If it is High, it should go to Critical.
Addition to that I want to add worknotes also -"Priority has been increased based on ticket XYZ." and details of a variable.
Can anyone please give any input on what workflow scripts should be written to achieve the same?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2017 01:55 AM
Hello Ankita,
In run script activity try below logic.
I have used "medium" and "critical" for example. You can use actual values there.
var ritm = current.variables.u_openedRequests;
var gr = new GlideRecord('sc_req_item');
if(gr.get(ritm)){
if (gr.priority =="medium")
gr.priority = 'critical';
else if ( same condition with different values)
else if( same condition with different values)
gr.update();
}
Hope it helps.
Kind Regards,
Jotiram

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 07:43 AM
Hello Ankita,
I'm assuming you want to calculate this on workflow at requested item level. You can use "Run script" activity in the workflow and the script will be something like.
if(current.request.state == 'PASS CHOICE VALUE HERE')
{
current.priority == 'PASS PRIORITY CHOICE VALUE HERE';
}
P.S: If you don't see priority getting updated directly then try to set impact and urgency value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 08:02 AM
Hi Pradeep,
I have a reference field on the catalog item which is pointing to ''sc_req_item'' table. PFA same.
I want to change the priority of the selected RITM not the current created one. And have to increase the priority of this selected RITM.
I am using the below script to get the value of the same, but it seems not working-
answer = ifScript(); |
function ifScript() {
if (current.variables.u_openedRequests.priority == '2') {
return 'yes';
}
return 'no';
}
Thanks in advance,
Ankita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2017 01:55 AM
Hello Ankita,
In run script activity try below logic.
I have used "medium" and "critical" for example. You can use actual values there.
var ritm = current.variables.u_openedRequests;
var gr = new GlideRecord('sc_req_item');
if(gr.get(ritm)){
if (gr.priority =="medium")
gr.priority = 'critical';
else if ( same condition with different values)
else if( same condition with different values)
gr.update();
}
Hope it helps.
Kind Regards,
Jotiram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2017 04:06 AM
Thanks Jotiram!
It worked.