List Collector records to display in related list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 01:35 AM
Requirement: When selections are made in a variable of type: List collector on the catalog form, display selected records on the RITM & TASK form under related list.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 01:56 AM
Hello Pooja,
First you need to create a relationship between tables, it can be either many to many(m2m) or 1 to many. Once you have the relationship in place, the system automatically creates a related list.
Identify the field that is relating the RITM and List collector table that is defined in relationship and insert records by using a sample script something like below if the relationship is m2m
var ci = current.variables.LIST_COLLECTOR_VARIABLE_NAME;
var arr = ci.split(',');
for(var i=0; i<arr.length; i++)
{
var gr = new GlideRecord('task_ci');
gr.initialize();
gr.task = current.sys_id
gr.ci_item = arr[i]
gr.insert();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 06:45 AM
The approach that dvp suggested will work, but another option might be to create a custom relationship so you don't have to create records on a table for every ritm. It may be a bit more complex since your list collector is a variable rather than form field, but you might want to check it out.