How to pass object array from script include using eventQueue() to notification email script?

Hari1
Mega Sage

Hi,

I have a requirement to update the software entitlement record assigned to users using record producer. Once the updated is done I need to get the software name and the entitlement name store in a object and push it to an array. I need to trigger a notification in a table format by passing the object values from the array.

Script Include - Object:

var obj = {user: <assigned to>, entitlement: <entitlement>};

arr.push(obj);

gs.eventQueue('usr_updated',current,arr);

Email Notification Script:

var storeVal1 = event.parm1;

gs.info("Script Include - Email Script - storeVal1[0]:" + JSON.stringify(storeVal1));

I am getting the output as {} empty object.

 

 

1 ACCEPTED SOLUTION

Sagar Pagar
Tera Patron

Hi,

Try this sample scripts to print elements-

 

for( var i=0; i< storeVal1.length; i++){

gs.info("user: " + storeVal1[i].user + " " + " entitlement: " + storeVal1[i].entitlement);

}

 

Thanks,

Sagar Pagar

The world works with ServiceNow

View solution in original post

2 REPLIES 2

Sagar Pagar
Tera Patron

Hi,

Try this sample scripts to print elements-

 

for( var i=0; i< storeVal1.length; i++){

gs.info("user: " + storeVal1[i].user + " " + " entitlement: " + storeVal1[i].entitlement);

}

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

script shared by Sagar should help you

Please try that and share us the updates.

Regards
Ankur

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