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:00 PM
Hi Gayathri,
Where did you write above script, is it BR?
If your requirement is whenever requester adds comment then change status from Pending to In Progress, you would need to write before BR with below configuration :
On Before Update BR
Condition : When state is Pending and Work notes changes
In script section, you can check if logged in user is requester then update state accordingly.
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-10-2022 10:27 PM
Hi Abhijit,
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,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 11:01 PM
Hi Gayathri,
Not sure where you are trying the script. But I think Business rule can solve your requirement.
Try business rule as follows:
'Before' 'update' business rule:
Condition: previous.incident_state == 4 && current.comments.changes()
Script:
current.incident_state = 2;
Hope it helps.
Thanks,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 11:41 PM