- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2017 09:23 AM
Hi community,
it is the first time I'm trying to set a group approval for an item.
For the catalog Item we are using the OOB related list to add the groups to approve the request. For what I was able to see that list is related with the sc_cat_item_app_group table.
I have based myself on this tread to create my script, Re: Group Approval so what I did was very similar:
var answer = [],
arr = current.group_list.toString(),
group;
var group = new GlideRecord('sc_cat_item_app_group');
group.addQuery('sys_id', 'IN', arr);
group.query();
while(group.next()){
answer.push(group.approval_group + '');
workflow.debug('user approval' + group.u_approval_group);
workflow.debug('approval: ' + answers);
}
My first question is the variable, current.group_list, I have used the ones available on the right side of the script field. Is this the correct one? Or should be used in a different way?
The result of this activity is "skipped", so there is no need to refer that it is not quite as I expect.
Any advise on this?
Thank you
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 03:02 AM
To make this work I used the solution that can be found here: Re: RITM Group Approval on Workflow
- var answer = (function() {
- var groups = [];
- var gr = new GlideRecord("sc_cat_item_app_group");
- gr.addQuery("sc_cat_item", current.getValue("cat_item"));
- gr.query();
- while (gr.next()) {
- groups.push(gr.getValue("approval_group"));
- }
- return groups;
- })();
Thank you for your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2017 09:26 AM
You just need to do below and it should work.
var answer = []; answer = current.group_list.toString(),
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2017 09:40 AM
Thank you for your reply.
It doesn't work, it is still skipping the approval.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2017 09:45 AM
var answer = ''; answer = current.group_list.toString(); gs.log('++++++++++my group list is '+current.group_list.toString());
Try the above code. Also check system log, what value is printed gor group_list.
I think you may need to change it the current.variables.group_list.toString(), if it is a variable and not field.
For variables use
var answer = ''; answer = current.variables.group_list.toString(); gs.log('++++++++++my group list is '+current.variables.group_list.toString());
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 03:02 AM
To make this work I used the solution that can be found here: Re: RITM Group Approval on Workflow
- var answer = (function() {
- var groups = [];
- var gr = new GlideRecord("sc_cat_item_app_group");
- gr.addQuery("sc_cat_item", current.getValue("cat_item"));
- gr.query();
- while (gr.next()) {
- groups.push(gr.getValue("approval_group"));
- }
- return groups;
- })();
Thank you for your help!