how to change the status of sc_req item dynamically in workflow ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 07:02 AM
With the help of scripting i want to change the status of sc_req item dynamically with the help of scripting in workflow , anyone help me
Set Value is not working in workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 07:19 AM
Hello @1dusjhyahnt
var itemID = current.sys_id;
var wr = GlideRecord('sc_req_item');
wr.addQuery('sys_id',itemID);
wr.query();
while(wr.next())
{
wr.state = '1';
wr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 07:13 AM
Hi @1dusjhyahnt ,
Add Run Script activity in workflow , add following script in workflow:
ifscript();
function ifscript(){
var item = new GlideRecord('sc_req_item');
item.get(current.request_item.sys_id);
item.state='closed';//update your value
item.update();
}
Please mark it as helpful (or) correct if it helps.
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2024 07:16 AM
Hello @1dusjhyahnt ,
If you are trying to close the same RITM for which workflow is running you can just add activity called "set field values", after the activity where you want to close the RITM, and you can just set state value accordingly.
Please mark this accepted if it works.