- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2015 07:14 AM
Hi All,
I used to get the value from the catalog item and assign it to workflow scratchpad and use it in the workflow.
workflow.scratchpad.userID = current.variables.requested_for.user_name;
workflow.scratchpad.groupID = current.variables.group.u_security_group.u_sam_account_name;
This way, where "requested_for" and "group", was my reference field.
Now Im trying to have this replaced with List collector, so that I can have multiple users added to multiple groups, so for this I need to loop through users and groups. For this I tried :
var lists = current.variables.group;
var arrays = list.split(",");
for (var i=0; i < arrays.length; i++) {
workflow.debug("Display value is: " + arrays[i]);
workflow.scratchpad.groupID = arrays[i];
}
But I get error in the workflow saying, split is not a function. Could anyone help me to resolve na d achieve this?
Any help is Appriciated!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2015 10:56 AM
Here you go.. , hope this helps someone
var userdomains = [];
var answer = [];
var arr = current.variables.requested_for.toString();
var listArr = arr.split(',');
for (var i=0;i<listArr.length;++i) {
var user = new GlideRecord('sys_user');
user.addQuery('sys_id',listArr[i]);
user.query();
while(user.next()){
answer.push(user.source.getDisplayValue());
workflow.debug('one user' + user.source);
var tc = new TCActiveDirectory();
workflow.scratchpad.userDomain = tc.getDomainFromSource(user.source);
workflow.debug("test Display value of user domain is: " + workflow.scratchpad.userDomain);
userdomains.push(workflow.scratchpad.userDomain);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2015 08:39 AM
You named your variable "lists" but used "list" (missing the s) in the split method.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2015 09:09 AM
I tried correcting it..., no luck!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2015 09:22 AM
Try this modification in your code and check
var lists = current.variables.group.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2015 10:11 AM
Pradeep,
In the above code, Im getting "workflow.scratchpad.groupID" as the sys_id.. , How do I get the name?
Thanks,
Sowmya