- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2018 09:56 AM
I'm building an array of user Sys IDs and trying to pass the array as Parameter 1 in a Create Event workflow activity. This triggers an email and then I'm using a mail script in that email to add the array in parm1 as users to be Cc'd.
Unfortunately, the value of parm1 is always ending up as "true" instead of ending up as the array. I'm confirming this in the Event Log as well as by using template.print() in the mail script.
Here is the script that I have in the Parameter 1 field in the workflow activity:
(function() {
var ccRecipients = [
current.sysapproval.u_requested_for,
current.approver.manager
];
gs.info('Approval Reminder - Cc Recipients: ' + ccRecipients.toString());
return ccRecipients;
}());
The record being written to the system log with gs.log() above is printing the Sys IDs.
In the Parameter 2 field, I'm just passing a simple string which is working just fine when event.parm2 is called in the email.
I was initially using return ccRecipients.toString() but found in the product documentation that any strings returned as parameters in these activities have to be surrounded with quotes (" ").
Any idea why Parameter 1 is returning "true"?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2018 09:30 AM
Even though the documentation doesn't explicitly state that it has to return a string - only that if it is a string, it needs to be surrounded in quotes - it seems that you're right and it really can only return a string.
I went ahead and just used a Run Script activity and called my event from there and it's working as intended.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2018 10:09 AM
I think your script (which needs to return a string) looks like it should work. I do see one potential issue though. The 'sysapproval' field references the 'task' table. Unless your 'u_requested_for' field sits on the 'task' table you won't be able to dot-walk to it directly. What table is your 'u_requested_for' field defined on?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2018 04:47 AM
Just checking on on this one. Has this question been answered or is there more information I can help you with? If it's been answered, please mark the answer above as the correct one so people know this has been taken care of. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2018 09:30 AM
Even though the documentation doesn't explicitly state that it has to return a string - only that if it is a string, it needs to be surrounded in quotes - it seems that you're right and it really can only return a string.
I went ahead and just used a Run Script activity and called my event from there and it's working as intended.