Advanced condition on a notification

palmen
Tera Guru

We want a notification to be send only when the ticket is updated by someone else then the person/s on work notes list.

Is this possible to script with an advanced condition?

 

What I've been trying without success is the following two examples

 

if (current.work_notes_list != current.sys_updated_by){

  answer = true;

}

 

OR

 

if (current.work_notes_list.user_name != current.sys_updated_by){

  answer = true;

}

 

I always get it to return true even if it's updated by the person who is in the "work notes list" field.

1 ACCEPTED SOLUTION

i hate it when at times you get a sys_id, and then when you want it, you have to dig to get it.




var gr = new GlideRecord('sys_user');


gr.query('user_name',current.sys_updated_by);


gr.query();


if (gr.next())


{    


      uid = gr.sys_id;


      if(current.work_notes_list.toString().indexOf(uid) != -1)


              answer = true;


      else


              answer = false;


}


else


      answer = false;




If the user cannot be found in the sys_user table, it will not send - change line 13 to switch that



If it finds a matching user, it then looks and if the user Id is in the work_notes_list, it will send otherwise it will not


you can switch it by adding an ! at line 7, or swapping lines 8 and 10 around



Cheers


View solution in original post

14 REPLIES 14

I tend not to declare the answer variable.   Seen is cause a problem before


change the variable name thats just a flag


It's triggered on insert/update to a ticket


Condition is work notes changes.



Problem we have is when the ticket send a mail to users on the work notes list and they reply to it, the reply will be posted as a work note, and they'll get a new mail notification containing info from the work note list (which is the actual mail they send in).


Jim Coyne
Kilo Patron

If I understand the issue properly, I think your solution should be as simple as ensuring the "Send to event creator" checkbox is NOT checked on the Notification record (you may have to switch to the Advanced view to see it).


That should work as well I assume. Will have to test it later on.