- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 06:16 AM
Hi All,
I need to get the assignment group of a catalog task on the description. The below scripts is working except for printing the Display value of the Grouip
grpp=[];
for(i=0;i<grpp.length;i++)
{
var gr= new GlideRecord('sc_task');
gr.request_item=current.sys_id;
gr.short_description='bingo fullillment group is : ' +grpp[i].getDisplayValue(); // Using grpp[i].getDisplayValue(); returns undefined
gr.description='bingo - description of this RITM';
gr.assignment_group=grpp[i];
gr.insert();
}
Catalog tasks are getting created as intended
Thanks in advance
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 11:52 AM
okay, seems WF is not using ArrayUtil();
try this...
function retGrpName(val){
var gr = new GlideRecord('sys_user_group');
gr.addQuery('sys_id',val);
gr.query();
while (gr.next()) {
return gr.name;
}
},
gr.request_item=current.sys_id;
current.variables.dummy = grpp[i];
gr.short_description='bingo fullillment group is : ' + retGrpName(grpp[i]);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 06:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 06:37 AM
Hi Sohan
What is in your grpp array?it looks like the values in the array are not correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 08:09 AM
Hi Harsh,
The grpp array contains the sys id of the 4 returned group. I am inserting this group sys id in the assignment group of the catalog task consecutively and it is working fine.
However, I need to include the assignment group name in the short description of the catalog task which isnt happening.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 08:19 AM
Try this:
grpp=[];
var list = grpp[i].join(',');
var gr= new GlideRecord('sc_task');
gr.request_item=current.sys_id;
gr.short_description='bingo fullillment group is : ' + list.getDisplayValue();
gr.assignment_group=grpp[i];
gr.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 08:33 AM
Hi David,
thanks for your persistent help, the issue still persists
Workflow runscript (updated it as per the code provided by you)
var grpp=[];
var grp= new access007();
var grpp= grp.getgroup();
for(i=0;i<grpp.length;i++)
{
var list = grpp[i].join(',');
var gr= new GlideRecord('sc_task');
gr.request_item=current.sys_id;
gr.short_description='bingo fullillment group is : ' + list.getDisplayValue();
gr.assignment_group=grpp[i];
gr.insert();
}
Thanks in advance