- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 01:07 AM
Hi @Lkowalski your BR should be on sc task table
when to run After update checked
cond : state changes
share your updated script here to check
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 01:34 AM
Hello @Lkowalski ,
Please make sure business rule is on sc_task table. And the when to run conditions are satisfied.
If it is not working for you, please share the screenshot of your conditions and the script as well.
Regards
Siddhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 02:42 AM - edited 02-02-2024 02:43 AM
SCRIPT:
(function executeRule(current, previous /*null when async*/ ) {
var ritmGr = new GlideRecord('sc_req_item');
ritmGr.get(current.request_item);
switch(current.state.toString()) {
case '1': //Pending
ritmGr.state = -5; //Pending
break;
case '2': //Work in Progress
ritmGr.state = 2; //In Progress
break;
case '3': //Awaiting Customer
ritmGr.state = 6; //Awaiting Customer
break;
default:
ritmGr.state = current.state;
}
ritmGr.update();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 02:46 AM
Hello @Lkowalski ,
Your script looks correct. Please confirm the Item is IT security. If that's correct can you put some gs.info into your code. And let me know if you are getting logs or not.
Regards
Siddhesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 03:25 AM - edited 02-02-2024 03:27 AM
Hello @Lkowalski ,
Looks like your issue is resolved. I will suggest add one more condition in your when to run as, "State changes". It will avoid the business rule to run unnecessarily. Let me know what you think.
Cheers,
Siddhesh