- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 09:03 PM - edited 02-17-2023 02:11 AM
@Ankur Bawiskar/friends, Sir please help
I need to Update the State in RITM which is showing as what ever the value is showing below I have to make it to closed complete - state. When the stage is complete
1- work in progress
2 - pending
3 - Open
PLEASE HELP VERIFY IMAGE ATTACHED AS WELL
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 09:55 PM
Hi Aravind,
This script will do the work. Just try to run it in Background-script
var item = new GlideRecord('sc_req_item'); item.addActiveQuery(); item.query(); while(item.next()){ var label = item.getDisplayValue('stage'); if(label == 'Completed'){ var value = item.getValue('state'); if(value == 1 || value== 2 || value == -5){ item.setValue('state',3); gs.print(value); item.update(); } } } |
Please mark my answer as helpful or solution if this helps you,
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 10:40 PM - edited 02-16-2023 10:43 PM
Hi Aravind,
1, 2, & -5 refers to the backend value of the state choices. You can find the values under configure dictionary or show choice list by right clicking on the field label.
If you find my answer useful, please mark my answer Helpful !!
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 10:11 PM
if(value == 1 || value== 2 || value == -5){
Please confirm how these values are getting calculated what is 1 2 & -5 from where you are getting this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 10:40 PM - edited 02-16-2023 10:43 PM
Hi Aravind,
1, 2, & -5 refers to the backend value of the state choices. You can find the values under configure dictionary or show choice list by right clicking on the field label.
If you find my answer useful, please mark my answer Helpful !!
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2023 12:38 AM
var item = new GlideRecord('sc_req_item');
item.addActiveQuery();
item.query();
while(item.next()){
var label = item.getDisplayValue('stage');
if(label == 'Completed'){
var value = item.getValue('state');
if(value == 1 || value== 2 || value == -5){
item.setValue('state',3);
gs.print(value);
item.update();
}
}
}
Can you help with this with encoded query instead of calling in while loop