Advanced Condition for Notification

tom_pritchard
Kilo Contributor

Hello,

 

Our helpdesk has requested a notification be built to notify them when the customer visible notes field changes. A recent addition to the request is that the notification trigger only when the Caller updates the customer visible notes. The notification worked until I added the advanced condition. The script currently looks like this:

 

if (current.sys_updated_by == current.caller_id ) {

true;

}

 

Again, that doesn't appear to be correct because the notification isn't sending. Is something incorrect with the script?

 

Thanks!

1 ACCEPTED SOLUTION

What version are you running on?   The reason I ask is John E. Jasinski has a point about using the "Send when" = "Record inserted or updated" option and the condition fields.   Makes it easy, and in this case, you should be able to use it, BUT, depends on the version you are running.   The "Send when" option was added in Berlin (I think).   Plus, in order to use the field comparison feature that you will need, you need to be running at least Calgary.



So, if you are, there is an existing OOC notification called "Incident commented" you could use as a starting point or modify.   There's actually 2 of them, one that goes out to the Assigned to and Watchlist users and the other to the Caller.   Choose the right one, and you can modify the Conditions field by adding the highlighted part below:



Incident_commented.png



Now, with all that being said, sometimes you do actually have to use some scripting.   And it is considered "existing functionality".   Not doing anything wrong - there's a script field there for us to use in these cases.   So if you must use a script, this should work for you:



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


        answer = true;


}



Like Tony Fugere, William Sun and Subhajit Das mentioned above, you need to return "true" or set "answer = true" in the script.   And remember, both the "Conditions" and "Advanced conditions" fields must return "true" for the notification to go out.   And, if you are testing yourself with your own tickets, the "Send to event creator" field would have to the selected for the email to go out (on the "Who will receive" tab or section, advanced view of the form).



OK, I'm done  


View solution in original post

11 REPLIES 11

I assumed he was parting from the event triggered incident.commented existing notification, and he was making a copy, or modifying it.


That should take care of the "when" it's triggered.


JohnJasinski
Tera Expert

My preference is to work only with existing functionality - When to send - with the check boxes for Inserted and Updated.   Anything beyond that would not be expected to add much value.   You can try to solve, but consider the value of the request. Keep IT Simple Smartie (KISS).


tom_pritchard
Kilo Contributor

Hi Everyone,



Thanks for the help.



I am Will's suggestion but the notification still isn't sending. Here's the code in use.



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



}



Thanks!


Tom


What version are you running on?   The reason I ask is John E. Jasinski has a point about using the "Send when" = "Record inserted or updated" option and the condition fields.   Makes it easy, and in this case, you should be able to use it, BUT, depends on the version you are running.   The "Send when" option was added in Berlin (I think).   Plus, in order to use the field comparison feature that you will need, you need to be running at least Calgary.



So, if you are, there is an existing OOC notification called "Incident commented" you could use as a starting point or modify.   There's actually 2 of them, one that goes out to the Assigned to and Watchlist users and the other to the Caller.   Choose the right one, and you can modify the Conditions field by adding the highlighted part below:



Incident_commented.png



Now, with all that being said, sometimes you do actually have to use some scripting.   And it is considered "existing functionality".   Not doing anything wrong - there's a script field there for us to use in these cases.   So if you must use a script, this should work for you:



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


        answer = true;


}



Like Tony Fugere, William Sun and Subhajit Das mentioned above, you need to return "true" or set "answer = true" in the script.   And remember, both the "Conditions" and "Advanced conditions" fields must return "true" for the notification to go out.   And, if you are testing yourself with your own tickets, the "Send to event creator" field would have to the selected for the email to go out (on the "Who will receive" tab or section, advanced view of the form).



OK, I'm done  


Thanks Jim.



So I met all the conditions to meet using the advanced script. What was missing was "...answer = true...". There within was the answer.



Thanks to everyone!