How send Multiple values into workflow event parameter?

siva44
Tera Contributor

Through workflow I have triggering the notification for that i have using workflow event activity but that have the 2 parameters how send multiple parameters and how to configured in notification body

 

siva44_0-1743596832317.pngsiva44_1-1743596909396.png

 

5 REPLIES 5

Community Alums
Not applicable

HI @siva44 ,

You can use the Sample script below :

you can write something like the following script in the event1 param field of the create event activity as:

(function() {
var arr= [];

arr.push(current.variables.owned_by);
arr.push(current.variables.managed_by);
arr.push(current.variables.primary_product_owner);
arr.push(current.variables.requested_for.requester_name);

return arr.toString();

}());

Here all the users are stored in an array and returning that array to the event param1.

 

Hi @Community Alums  could u pls provide script for notification body How call that array in email body

@siva44 

for that you need to use email script.

check my below response and it will help you to grab the values

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@siva44 

for sending multiple parameters and values, you will have to use email script to grab those values.

in workflow send this in event parm1

return current.variables.first_name + ',' + current.variables.line_manager;

Then in email script get the value and split and use in email body

(function runMailScript(current, template, email, email_action, event) {

    // Add your code here
    var parm1 = event.parm1;
    var arr = parm1.toString().split(',');
    var name = arr[0];
    var manager = arr[1];
    template.print('Name' + name);
    template.print('Manager' + manager);

})(current, template, email, email_action, event);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader