How to return a list of group sys_ids
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2008 06:35 PM
Hello,
I want to write a function which returns a list of groups I can use in a filter, for example:
Assignment group is javascript:myGroupList()
So, it is like the getMyGroups() function in that it needs to return a list of groups.
However, while I can assemble the groups I need, I'm not sure how to return it.
I've tried putting them into an array of group sys_ids. I've tried returning a string in the format
[group_sys_id, group_sys_id, group_sys_id]
... but neither of these gives me the result I need.
My question is, how do I return a "list" of group sys_ids from a function which can be used in a filter?
thanks
margie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2008 07:59 PM
Check the getMyAssignments() function in the getMyApprovals business rule. It returns an array of sys_user sys_ids that can be used in a filter like:
assigned_to is javascript:getMyAssignments()
Maybe it can point you in the right direction? I know getMyGroups() used to be in a business rule but was moved into the Java at some point, else you could use that as a guide instead.
Sorry and please disregard if you've already gone this route.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2008 09:13 PM
Thanks!
The bit I was missing was creating the string object as I pushed the item into the array.
So I've replaced:
groups.push(gr.sys_id);
with:
groups.push(new String(gr.sys_id));
and it works fine.
Many, many thanks.
margie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2008 07:55 AM
You could also use gr.sys_id.toString()
Here's some information on javascript variables being passed as value versus by reference. Converting the sys_id to a string forces the value to be passed as a value, breaking the link from the referenced object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2008 06:27 PM
Thanks - I appreciate your input, and it does help me understand what's going on.
margie