Create tasks based on number of inputs in list collector
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 03:26 AM
Hi everyone,
I have a list collector field on a catalog item.
User can be able to select n number of values into it.
So let's say for example, user has selected 3 inputs in the list collector field, so for Each input I am trying to create catalog task(one one task for one one input).
So, in the workflow I am using a Run script activity and getting all the inputs of the list collector field and storing in an array.
Below pics shows you the exact scenario:
So, can some one help me how to write script in for loop.
like:
var gr = new GlideRecord('sc_task');
gr.initialize();
gr.request = current.request;
gr.sys_id = current.sys_id;
now: the short description should be like this, (it should populate with first value of the array)
gr.short_description = ar[i]; //here 4Sight as in the above pic that is the first entry of the array.
gr.insert();
Like wise I want to create 3 catalog tasks (as the user selected 3 inputs in the list collector)
Please help me
Regards,
Pallavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 05:34 AM
Yes Mohith,
THere are no spaces.
Not understanding where it is wrong/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 05:40 AM
@Pallavi65 all three records are there in the table ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 06:44 AM
Only one sc_task is getting created when I select 3 applications.
Regards,
Pallavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 06:52 AM
@Pallavi65 what i meant is all three application records are present in application table with exact names ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 06:54 AM
Yes, it's a list collector field. So, we wont type in it manually instead we will select the list of applications from the list which are existing/
(Similar to reference field)
Regards,
Pallavi