Auto update of state from Pending to Inprogress when user inputs are given
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 10:53 PM
Auto update of state from Pending to Inprogress when user inputs are given
As a user,
I would like my request state to change from 'Pending' with reason 'awaiting caller' to 'Inprogress' when I add a comment
so that fulfiller can continue to work on request there after
I got this question and I created script as below.
gs.include('validators');
if (current.getTableName() == "sc_task") {
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
current.state = 2;
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
current.priority = email.body.priority;
}
current.update();
}
please help me with the solutions.
- Labels:
-
Change Management
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 11:46 PM
Hi Gayathri,
BR looks good to me.
You would need to refresh page if you are adding additional notes by using post button beside that field.
Did you impersonate with requester for user to test?
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 11:53 PM
also to debug further, you can add info message to check if BR executing and it is going inside if condition.
if(gs.getUserID()== current.requested_for)
{current.state = 2;
gs.addInfoMessage("Inside If condition");
}
gs.addInfoMessage("Inside Business rule");
If it is going inside business rule but not inside if condition then try below,
gs.getUserID()==current.requested_for.toString()) or gs.getUserID().toString()==current.requested_for.toString()
Let me know if you have any further queries.
Please mark this as Correct or Helpful if it helps.
Thanks and Regards,
Abhijit
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 11:54 PM
Hi Abhijit,
Comments added but business rule is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 12:02 AM
Could you please add here screenshot of tested example. also it didn't go inside BR,right?
Regards,
Abhijit
ServiceNow MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-11-2022 02:12 AM
Above Br is working fine thank you for your help, but we had one more requirement addon.
below screenshot is the email trigger when state is pending and reason awaiting caller.
once user replies to the above mail then we need to change the state to working progress for this i think we need to use inbound action. Could you please help me on this.
Thanks,