Notification conditions not working

oharel
Kilo Sage

Hi,

This is the situations:

My employee onboarding application generates requested items per selections of the manager in the application form. I do not want the manager to receive back anywhere between 1 to 15 emails, one for each RITM, saying that the request for the item has been received and is being handled. If possible, I would like the manager to receive one mail only summarizing the entire order, or not at all.

In the RITM form I have a reference field, which is filled only when the source of the RITM is the employee onboarding application. If it's a regular order not related to the onboarding process, that field is empty.

My problem is that when trying to configure the notification condition to send only when the reference field is empty does not work.

I tried, for instance:

if(current.u_new_employee_req == '') {

  answer=true;

}

but other fields do not work as well.

This field (u_new_employee_req) is a reference field in the request, which is filled by the onboarding application and is cascaded to the RITM via a business rule, upon the creation of the RITM.

I am wondering maybe the request is generated before all the fields are populated?

Is there any way to tell the notification not to be sent if the source of creation is the onboarding app?

Thanks

Harel

1 ACCEPTED SOLUTION

You can do this using Normal conditions instead of using advanced condition. In your script you need to use && instead of ^


View solution in original post

9 REPLIES 9

randrews
Tera Guru

ok a few questions it sounds as if what is happening is you are having the managers fill out ONE request with multiple items <one for each new employee>



if this is correct is there something unique about the request.. perhaps it might be better to trigger the notification from the request instead of the item...


Hi Doug,



Yes, as you described it: one request with multiple items.


The request itself is being generated by a business rule:


////bunch of needOrder == true RITMs here, then this to create the request:


if (needOrder == true) {  


      var rc = cart.placeOrder();  


      gs.addInfoMessage(rc.number);  


      current.u_items_request = rc.sys_id;



var scReq = new GlideRecord('sc_request');


var twoWeeksFromNow = gs.daysAgo(-14);


scReq.addQuery('sys_id', rc.sys_id);


scReq.query();


if (scReq.next()) {


  scReq.u_new_em_request_num = current.sys_id; //type reference


  scReq.u_nem = true; //to mark a NEM request


  scReq.requested_for = current.u_manager;


  scReq.due_date = twoWeeksFromNow;


  scReq.short_description = "new employee request for " + current.u_employee_first_name + " " + current.u_employee_last_name;


  scReq.update();


// gs.addInfoMessage(current.number.getDisplayValue());


}



as you can see from here:


scReq.u_new_em_request_num = current.sys

the request gets the number of the onboarding request in a field called u_new_em_request_num. I tried to create a condition in the RITM that if that *is* empty, the notification should not be sent (if it is not empty, then it is an employee onboarding request). That did not help. Maybe my advanced script was wrong?




How do I filter the requested items which belong to a request generated by the onboarding process? Once I do that, I can create other emails to be sent fro the request itself...



harel


i assume all the new hires are using the same item.. try using the condition builder to eliminate that item from sending the item notification.


Please explain what you mean by "using same item".


I first tried to use the condition builder to tell it that if the fields are not empty - either in the RITM or the parent request - don't send the notification, but that did not help.


Is there a way to debug notifications? See if they meet conditions, for example?