- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2017 04:27 AM
Hi,
Im able to create individual task from the values from the list collector but this issue im having is displaying the list collector value in the task short description.
Script below:
var abc = [];
var abc = current.variables.apps.toString();
var xyz = [];
var xyz = abc.split(',');
var length = xyz.length;
for(var i=0; i<length;i++){
var task = new GlideRecord("sc_task");
task.initialize();
task.parent = current.sys_id;
task.short_description = current.variables.request_type.getDisplayValue() + " Aplication access: " + xyz[i]; // the issue: I believe im just getting the sys ID
task.description = current.variables.comments;
task.request=current.request;
task.request_item = current.sys_id;
task.assignment_group = '179e890737deb640ad36616043990e14';
task.insert();
}
Thanks,
Lucy
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2017 05:00 AM
Hi
Yes a list collector is essentially just a comma seperated list of sys_ids
You can either
- Get the display value of the list collector: var abc = current.variables.apps.getDisplayValue();
- Or in the for loop get a gliderecord for each sys_id in the table your list collector is pointing to
var gr = new GlideRecord('list_collector_table');
gr.get(xyz[i]);
task.short_description = current.variables.request_type.getDisplayValue() + " Aplication access: " + gr.getDisplayValue();
Option 1 is only possible, if the display values of the records in your list collector does not contain commas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2017 05:00 AM
Hi
Yes a list collector is essentially just a comma seperated list of sys_ids
You can either
- Get the display value of the list collector: var abc = current.variables.apps.getDisplayValue();
- Or in the for loop get a gliderecord for each sys_id in the table your list collector is pointing to
var gr = new GlideRecord('list_collector_table');
gr.get(xyz[i]);
task.short_description = current.variables.request_type.getDisplayValue() + " Aplication access: " + gr.getDisplayValue();
Option 1 is only possible, if the display values of the records in your list collector does not contain commas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2017 06:10 AM
Thanks Lars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2017 05:02 AM
The list collector values filled in the catalog form are stored as sysids(Variable Ownership table). I doubt you can dotwalk to the table fields or get the display value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2017 05:03 AM
You might need to add 1 more GlideRecord in above code to get display value:
task.parent = current.sys_id;
var getAppsValue= new GlideRecord('appsTable'); //the table which apps variable is referring to
getAppsValue.addQuery('sys_id',xyz[i]);
getAppsValue.query();
if(getAppsValue.next())
task.short_description = current.variables.request_type.getDisplayValue() + " Aplication access: " + getAppsValue.name;