Incident -Clearing pending reason value when state is not in 'Pending' in Incident

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2020 03:43 AM
Hi all,
I have a query that whenever the user changes the state manually from 'Pending' to 'In-progress', the pending reason gets cleared automatically. However in cases where the state changes from Pending (pending reason - pending customer) to 'In-Progress' when additional comments are entered by caller or mail sent by caller, the pending reason doesn't get cleared off as it still holds the value 'pending customer' but it is suppose to display in activity history like the below screenshot.
Image:
Thnaks,
Dinesh.M

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2020 03:56 AM
That's because there is a onChange client script/UI policy on state field which is clearing out value when state changes from pending to some other state.
But when ticket is updated on server side then that's not happening because your client script won't run there. So add a before business rule with same logic and that will so the trick.
-Tanaji
Please mark reply correct/helpful if applicable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2020 04:04 AM
Hi Tanaji,
Below is the script written in inbound action :
(Note:when customer replies through email the below script will workout).
gs.include('validators');
if (current.getTableName() == "incident") {
//current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
var index = email.subject.indexOf("INC");
var incNumber = email.subject.substring(index,index+10);
//gs.log('The incident number:' +incNumber);
var gr = new GlideRecord('incident');
gr.addQuery('number',incNumber);
gr.query();
while(gr.next())
{
if ((email.from == current.caller_id.email) && (current.state == 9) && (current.hold_reason == 1))
{
current.state = 2;
current.hold_reason==''; //Have added this line to make pending reason go empty but did not help.
}
current.update();
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2020 05:24 AM
Please change
current.hold_reason=='';
to
current.hold_reason = '';
== is used for comparision and = is used for assignment.
-Tanaji
Please mark response correct/helpful if applicable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2020 06:55 AM