Hi Saksi,



We have recently cloned back our production environment to TEST and DEV so we know the users are setup correctly as they are getting other notifications.



Business Rule


find_real_file.png


find_real_file.png



Notification



find_real_file.png


find_real_file.png


find_real_file.png



find_real_file.png



Let me know if you need anything else



Thanks


Hi Sakshi,



Do you need anything else from me other than the above, would like to try and get this one ticked off



Thanks



Sam


Hey Sam,



Sorry was caught up with my implementation specialist exam.



This is puzzling, the order of tasks shouldn't make any difference, can you please modify the BR as follows -



function executeRule(current, previous /*null when async*/) {


var email_to = [];
var sc_task = new GlideRecord('sc_task');
sc_task.addQuery('request_item',current.sys_id+'');
sc_task.addActiveQuery();                             //eliminates the inactive/closed tasks, optimizes the results
sc_task.query();
while (sc_task.next()){


  gs.log("sam1");
  if (sc_task.assigned_to == "" || sc_task.assigned_to == null){                 //included the null keyword as sometimes the system doesn't compare successfully with ""
                gs.log("sam2 "+sc_task.assignment_group.manager);


                email_to.push(sc_task.assignment_group.manager+'');
  }
  else{                                                                                                                                                                                                 //added an else to optimize the query
              gs.log("sam3 "+sc_task.assigned_to);


              email_to.push(sc_task.assigned_to+'');
  }
}


gs.log("sam4 "+email_to);
gs.eventQueue("sc_req_item.commented.itil", current, email_to.join(), gs.getUserName());


})(current, previous);




I've just tweaked the logs and the email_to.push statement.



Please run all the 4 use cases and share the logs/results:


1. both tasks have assigned to


2. both tasks don't have assigned to


3. task 1 has assigned to & task 2 doesn't


4. task 2 has assigned to & task 1 doesn't


View solution in original post

Hi Sakshi,



Thanks for the above.   Hope your exam has gone ok.



I've ran the tests and evidence below.   From what I can tell this seems to now be working ok.



First Test - Both Tasks are unassigned:


find_real_file.png


Both Group Managers Get the Notification:


find_real_file.png


find_real_file.png


find_real_file.png



Second Test - 1 Task is assigned, the 2nd is still unassigned:


find_real_file.png


The person assigned gets the notification and the manager of the group of the unassigned task also gets the notification:



find_real_file.png


find_real_file.png


find_real_file.png



Third Test - Task 1 is unassigned, the 2nd task is assigned:


find_real_file.png


Both the person assigned get the notification and the manager of the group of the unassigned task get the notification (now working):


find_real_file.png


find_real_file.png


find_real_file.png



Fourth Test - Both tasks are assigned to people:


find_real_file.png


Both getting the notification:



find_real_file.png


find_real_file.png


find_real_file.png



Fifth Test - Both Tasks are assigned to people (reverse - to show both people can receive the notification):


find_real_file.png



Both Still getting the notification:



find_real_file.png


find_real_file.png


find_real_file.png



I'm going to run some more tests, but looking good.



Thanks for all your help on this - appreciate all your time over the last couple of months



Thanks Sam


Sakshi14
Giga Expert

Glad I could assist you! And yes, I cleared the exam too.