Incrementing a Call Count

Cupcake
Mega Guru

I have created a variable "Call counter" and another variable "Increment call" (which is a checbox), Here is my sceanrio:

1) Customer calls SD to have a ticket opened for an issue,

2) An hour later the customer calls back for a status, at this time the analysts checks the "increment call" button, the call counter starts at "0" and is suppose to increase each time the customer calls back.

3) So I need the call count value to be saved, I need the increment call option to be unchecked after the incident is updated, and I need the call counter value to increase by 1 the next time someone goes into that incident and clicks that increment call checkbox again.

Hope that makes sense.

Karen

1 ACCEPTED SOLUTION

ahaz86
Mega Guru

a before business rule would work for this i believe.



if(current.u_increment_call == true){


        var count = current.u_call_counter;


        current.u_call_counter = count + 1; // add one to the count


        current.u_increment_call = 'false'; // reset the count increment flag


}


View solution in original post

13 REPLIES 13

ahaz86
Mega Guru

a before business rule would work for this i believe.



if(current.u_increment_call == true){


        var count = current.u_call_counter;


        current.u_call_counter = count + 1; // add one to the count


        current.u_increment_call = 'false'; // reset the count increment flag


}


Hi Alex, thank you. Trying now, but not working.


I originally had this script set up as business rule should I have it as a calculated value.


what table are the 2 fields you created on? I will mock this up in a demo instance


Both variables are on the incident table. Thank you.