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

diNesh_M
Tera Contributor

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:

find_real_file.png

 

Thnaks,

Dinesh.M 

4 REPLIES 4

Tanaji Patil
Tera Guru

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

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();
}
}

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

Hi Tanaji,

Even after changing current.hold_reason=''; ,the issue persist.

Activity log has only the state value but not the pending reason value.

Kindly check the attachment.

 

Thanks