Making ticket active after pending user

shalini44
Tera Expert

Hello,

In our environment, when an incident in pending user Info state, it becomes active only if the requester replies to the system email. Is there a way to make the state as active if a person on watch list also replies on the ticket.

We use the following business rule. How can I can I loop of the watch list and make ticket active when one of them replies.

if (current.sys_updated_by == current.u_requested_by.user_name

{

  current.state = 2; //active state

}

Thanks for your looking and your suggestions.

Regards,

Shalini

1 ACCEPTED SOLUTION

I would place it in the inbound email script given your requirements. Otherwise any update to the ticket will kick it out of Pending User Info.


View solution in original post

9 REPLIES 9

ajbarnes
Tera Expert

Hi skapoor


You should be able to modify the condition there:



var arrayUtilWL = new ArrayUtil();


if (current.sys_updated_by == current.u_requested_by.user_name || arrayUtilWL.contains(current.watch_list, current.sys_updated_by) )


{


  current.state = 2; //active state


}


Thanks Andrew for replying. I tried your code, but the contains method returns false, even tough the user account is in the watch-list. What is the best way to test it in the test environment.



Thanks for your help!


Shalini


mike_allgire
Giga Guru

The simplest way would be to have the condition of to call the look up through a script include, so that it only runs when that condition is hit. If not wanting to use a condition, this should work.


if(current.sys_updated_by == current.u_requested_by.user_name || (!current.watch_list.nil() && isWatcher(current.watch_list)){


        current.state = 2;


}



function isWatcher(watchers){


        watchers = watchers.toString();


        for(i = 0; i < watchers.length; i++){


                  var gr = new GlideRecord('sys_user');


                  gr.get(watchers[i]);


                  if(current.sys_updated_by == gr.user_name){


                            return true;


                  }


        }


}


shalini44
Tera Expert

Thank you Mike for your reply.



I tried the code, but conditions for watchlist is coming out to be false even though the user is in the watchlist. I am testing using a test account that I've put in the watchlist. I am not sure why.



BR
Shalini