How do up update the value of a list collector in server side script???

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2011 05:50 AM
I have a catalog item were the user selects a list of groups. Then in the workflow I need to update that list collector then then allow the tech who is going to do the work review the items that are selected and then either select more items or remove items. The issue I am having is that in the workflow I update the selections that the user made but it does not save them.
I have tried the following methods of updating the value of the list collector to no avail.
current.variables.removeuser = removeListArray;
current.variables.removeuser.setValue(removeListArray);
current.variables.removeuser = removeListString;
current.variables.removeuser.setValue(removeListString);
Does anyone know how you can do this?
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2011 07:03 AM
It might be. If I were you I would start troubleshooting by breaking your script down into a very simple update with a static string like this...
current.variables.removeuser = 'a user sys_id here';
current.update();
Try that in a business rule against the item and then in the workflow against the item to make sure it works in both places. If it doesn't, then there probably is some sort of timing issue. If it does work there, then there's some other issue with your script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2011 07:04 AM
I just found another issue as I was typing this response. 'current.variables' should be 'current.variable_pool'.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2011 07:14 AM
Thats what I am trying right now is breaking it down.
As for the current.variables, according to the wiki both are valid, but I will try your way and see if it changes.
http://wiki.service-now.com/index.php?title=Scriptable_Service_Catalog_Variables

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2011 07:33 AM
Ok, so I just found one issue, for some reason my querys are not returning valid group sys_id's, that's why the system looks like it is not saving them. So now I have to figure out why it is not returning what I thought it should be.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2011 07:37 AM
Probably this then...
removeList.push(gr.sys_id);
If you want to add groups to the array then you need this instead...
removeList.push(gr.group.sys_id.toString());