notification is not working while trying to trigger notification when comments are updated in task

venu18
Tera Contributor

i was trying to trigger notification while comments updated on sc task level and notification need to trigger watchlist and assigned to members.

i have written below code

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

 

  // Add your code here
  var ritm = new GlideRecord('sc_req_item');

 

  if(ritm.get(current.request_item)){

    {
      //var watchlist=ritm.watch_list;
      var watchlist=[];
      gs.log("watchlist"+watchlist);
    var notes = current.comments.getJournalEntry(-1);//gets all journal entries as a string where each entry is delimited by '\n\n'
    //var na = notes.split("(Additional comments)");
    var na = notes.split("\n\n");
    var com1=na[0];
    var com=com1.split("(Additional comments)");
    var givencomments=com[1];
      gs.log("watchlist1"+givencomments);

    var substring="Escalation Comments :";
      watchlist.push(ritm.watch_list+'');
    //if(givencomments.indexOf(substring)==-1)
      //{
        if(current.assigned_to!='')
        {
          gs.log("watchlist2"+watchlist);
        gs.eventQueue('item.comments.updated',current,current.assigned_to,watchlist.join(','),givencomments);
        //gs.eventQueue('item.comments.updated', current,current.comments,task.assigned_to);
      }
      else{
        gs.eventQueue('item.comments.updated',current,current.assignment_group,watchlist.join(','),given comments);
        gs.log("watchlist3"+watchlist);




        //gs.eventQueue('item.comments.updated', current,current.comments,task.assignment_group);
      }
    }

  }
//}

 

})

 

logs are working but the notification was not triggering please check and suggest this issue.

 

1 REPLY 1

Alex Tod1
Kilo Sage

Hi @venu18,

  1. Go at event log and check if your event is triggered with correct parameters.

  2. If is triggered correctly, check the condition from the notification.

  3. Also if condition is met, try to add your email adress or any adress that you are sure is correct.