Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

Can I use an event parameter into Notification Next Experience Content

FabianV
Tera Contributor

I'm creating a provider notification that is triggered by an event. I'm unsure if it's possible to pass the event parameters to the Next Experience Content of the notification.

 

FabianV_0-1716864535930.png

 

Is there a way or isn't possible?

3 REPLIES 3

Jamie Stroud
Tera Guru

I have the same question. I tried using ${event.parm2} in my 'Message' content and it came up blank, although I do see the expected value in Parm2 of the event in the log.

ArunaSukruM
ServiceNow Employee

any luck? if we can use {event.parm2} in messages ?

Hello @ArunaSukruM,

You can use Advanced field and use the eventParms in the script. 
The script return a JSON object and can be used as shown below: 

(function(current, eventName, eventParm1, eventParm2, previousActors) {
     /**
     * Generates a notification object based on the provided parameters.
     * @param {GlideRecord} current - Reference to the table record
     * @param {string} eventName - Name of the event that triggered the notification.
     * @param {string} eventParm1 - First parameter related to the event.
     * @param {string} eventParm2 - Second parameter related to the event.
     * @param {Array} previousActors - List of previous actors who have triggered this notification.
     * 
     * @returns {Object} Notification object containing the following properties:
     * - actor: Sys ID of the user who triggered this notification.
     * - messageContentTemplate: A translatable template for the notification message content.
     * - messageContentParams: An string parameters to be inserted into the message content template.
     * - aggregatedContentTemplate: A translatable template for aggregated notification content.
     * - aggregatedContentParams: An array of parameters to be inserted into the aggregated content template.
     * - actionUrl: URL for navigation when the notification is clicked.
     */
     return {
         actor: '',
         messageContentTemplate: 'Return Value is: {0}',
         messageContentParams: [eventParm2],
         aggregatedContentTemplate: '',
         aggregatedContentParams: [],
         actionUrl: ''
     };
 })(current, eventName, eventParm1, eventParm2, previousActors);


Thank you and regards,
Harsh