- 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 10:15 AM
Use getDisplayValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2015 10:40 AM
If I use the group as "list collector" variable I get an error saying "nill is not an function"
answer = ifScript();
function ifScript() {
if (current.variables.group.u_approval_type.nil()) {
return 'yes';
}
return 'no';
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2015 10:50 AM
I just tried and it works. If you still get an error you can check as empty quotes in the if condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2015 05:07 AM
Pradeep, I'm doing dot walking like below, again Im not able to use "split".
var user = current.variables.requested_for.source;
var arr = user.split(",");
Gives an error saying, split is not a function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2015 05:18 AM
ok, this is what im trying to achieve.
I used to get the userdomain and the group domain by below:
var tc = new TCActiveDirectory();
workflow.scratchpad.userDomain = tc.getDomainFromSource(current.variables.requested_for.source);
workflow.debug('User Domain=' + workflow.scratchpad.userDomain);
workflow.scratchpad.groupDomain = tc.getDomainFromSource(current.variables.group.u_security_group.u_distinguished_name);
workflow.debug('Group Domain=' + workflow.scratchpad.groupDomain);
Now since I cheanged the reference fiend to list collector, I tried below
var tc = new TCActiveDirectory();
var user = current.variables.requested_for.getDisplayValue().toString();
var arr = user.split(",");
for (var i=0; i < arr.length; i++) {
workflow.debug("Display value of userdomain 1 is: " + user);
workflow.debug("Display value of userdomain 2 is: " + workflow.scratchpad.userDomain);
workflow.scratchpad.userDomain = tc.getDomainFromSource(user.source);
}
var group = current.variables.group.getDisplayValue().toString();
var arra = lists.split(",");
for (var i=0; i < arra.length; i++) {
workflow.debug("Display value of groupdomain1 is: " + workflow.scratchpad.groupDomain);
workflow.debug("Display value of groupdomain2 is: " + group);
workflow.scratchpad.groupDomain = tc.getDomainFromSource(group.u_security_group.u_distinguished_name);
}
Looking for some help.
Thanks,
Sowmya