Notification for different users with their name in message body

deepak50
Tera Contributor

Hi All,
Is there a way to send a notification for multiple contacts with their names in notification template.
For eg an account has 5 contacts as contact1, contact2, .....contact5.
and we have to send notification to all 5 contact with their name in message.

eg hi contact1.name .......

 

Is this possible to do this through one notification only or we have to generate 5 notifications using scripts to 5 individual users with their names in message.

Thanks
Deepak

5 REPLIES 5

SumanKumarM
Tera Contributor

Hello Deepak50,

Please refer below link,

https://www.servicenow.com/community/itsm-forum/send-notification-to-user-assignment-group-and-assig...

 

Please mark helpful, if content is helpful.

 

Thanks,

Suman

mihirlimje867
Tera Guru

Hello @deepak50 ,

You can create 5 different notifications, and it will also work. but I have another solution with the single notification we can achive to send the same notification to different people.


Step1: Create a event from 'Event registry' Module.


Step2: Create the notification and set 'event is fired' in 'send when' field and select the created event.
For the recipient check the 'Event parm 1 contains recipient' checkbox in notification 
In the body of notification you can add the ${event.parm1} for the contact person.


Step3: Create a BR and set when to run condition whenever you want to send a notification.
In that BR script you can create a for loop with condition 

var arr = [current.contact1, current.contact2, current.contact3, current.contact4, current.contact5];

for( var i=0;i<5;i++){
gs.eventQueue('event_name',current,arr[i]);
}


I hope this will help you at least you got an idea.
Please hit on the helpful button.

Thank you.


Hi ,

 

var arr = [current.contact1, current.contact2, current.contact3, current.contact4, current.contact5];

var arr2=[current.contact1.name,current.contact2.name,current.contact3.name,current.contact4.name,current.contact5.name];// capture names in an array

for( var i=0;i<5;i++){
gs.eventQueue('event_name',current,arr[i],arr2[i]);
}

 

 

 

 

deepak50
Tera Contributor

Hi,

By 5 notifications I meant 5 records for same type of notification , If we generate 5 events those will also create 5 notification records of same type.

I was checking if we can achieve this using single notification record,

 

Thanks

Deepak