- 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 09:42 AM
Are you using this in a WF Script ? If yes, then the following logic will work
create a dummy custom.variables e.g. custom.variables.dummy
Make sure grpp[i] has value in it first...
e.g:-
gr.request_item=current.sys_id;
custom.variables.dummy = grpp[i];
//gr.short_description='bingo fullillment group is : ' +grpp[i].getDisplayValue();
gr.short_description='bingo fullillment group is : ' +custom.variables.dummy.getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 10:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 10:34 AM
Using that script: just
gr.short_description='bingo fullillment group is : ' +current.variables.dummy.getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 11:09 AM
Hi Sharique,
thanks a ton for your patience, I have pasted the update code and log sceenshot on the below conversation of Shiladitya. Can you please take a look
Meanwhile, I am also trying with your previous code where you gave updated both workflow script and script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 10:37 AM
Sorry typo mistake..
Instead of custom use current
gr.request_item=current.sys_id;
current.variables.dummy = grpp[i];
//gr.short_description='bingo fullillment group is : ' +grpp[i].getDisplayValue();
gr.short_description='bingo fullillment group is : ' +current.variables.dummy.getDisplayValue();