<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Create multiple tasks for one catalog item in ServiceNow AI Platform forum</title>
    <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062167#M18556</link>
    <description>&lt;P&gt;Hi Dibeena,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Can you please share Run Script code you have used?&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 14 Sep 2017 07:22:03 GMT</pubDate>
    <dc:creator>PrashantLearnIT</dc:creator>
    <dc:date>2017-09-14T07:22:03Z</dc:date>
    <item>
      <title>Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062165#M18554</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a catalog item which has a list variable. This list variable is used to select users from the user table.&lt;/P&gt;&lt;P&gt;What I am trying to achieve: when the RITM gets approved, it should create a task for each user in the list variable.&lt;/P&gt;&lt;P&gt;Attempts did: I tried to create the task from the workflow using "Run Script". It did create the required number of tasks for one RITM, but I cannot see any variables of the RITM in the Variable tab of TASK.&lt;/P&gt;&lt;P&gt;The script I used to create task is:&lt;/P&gt;&lt;P&gt;//users = list variable&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;var a=current.variables.users;&lt;/P&gt;&lt;P&gt;var a_split=a.toString().split(',');&lt;/P&gt;&lt;P&gt;for(var i=0;i&amp;lt;a_split.length;i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;var gt=new GlideRecord('sc_task');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gt.initialize();&lt;/P&gt;&lt;P&gt;gt.short_description='task created: '+i;&lt;/P&gt;&lt;P&gt;gt.request_item=current.sys_id;&lt;/P&gt;&lt;P&gt;gt.assignment_group.setDisplayValue('Client Support');&lt;/P&gt;&lt;P&gt;gt.parent = current.sys_id;&lt;/P&gt;&lt;P&gt;gt.insert();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find the RITM and TASK screenshot attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would prefer the variables to appear on the variable Tab, but also the "Requested for:" should have only the user from the list variable. Is it possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Dibeena&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 07:05:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062165#M18554</guid>
      <dc:creator>dibeenapearl</dc:creator>
      <dc:date>2017-09-14T07:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062166#M18555</link>
      <description>&lt;P&gt;requested for field on the RITM and Task is coming from request, it will be always dot walk field.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;check global checkbox on the variables it will show on the task&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Sep 2017 07:21:17 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062166#M18555</guid>
      <dc:creator>gdd</dc:creator>
      <dc:date>2017-09-14T07:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062167#M18556</link>
      <description>&lt;P&gt;Hi Dibeena,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Can you please share Run Script code you have used?&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Sep 2017 07:22:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062167#M18556</guid>
      <dc:creator>PrashantLearnIT</dc:creator>
      <dc:date>2017-09-14T07:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062168#M18557</link>
      <description>&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;//users = list variable&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;//&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;var a=current.variables.users;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;var a_split=a.toString().split(',');&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;for(var i=0;i&amp;lt;a_split.length;i++)&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;{&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;var gt=new GlideRecord('sc_task');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;gt.initialize();&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;gt.short_description='task created: '+i;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;gt.request_item=current.sys_id;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;gt.assignment_group.setDisplayValue('Client Support');&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;gt.parent = current.sys_id;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;gt.insert();&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;}&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Sep 2017 07:32:02 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062168#M18557</guid>
      <dc:creator>dibeenapearl</dc:creator>
      <dc:date>2017-09-14T07:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062169#M18558</link>
      <description>&lt;P&gt;i think it should be working properly &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Sep 2017 07:46:07 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062169#M18558</guid>
      <dc:creator>gdd</dc:creator>
      <dc:date>2017-09-14T07:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062170#M18559</link>
      <description>&lt;P&gt;Thanks, Girish. I made the variables global and now I can see the variables in the TASK.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Sep 2017 12:40:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062170#M18559</guid>
      <dc:creator>dibeenapearl</dc:creator>
      <dc:date>2017-09-14T12:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062171#M18560</link>
      <description>&lt;P&gt;Thanks for that.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;One issue is still there. Each TASK shows all the users.I selected two users and it is preferable to see only one user as "Requested For:" in one TASK. Is it possible&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Is it possible to show only one user in each TASK as "Requested For:"?&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Sep 2017 12:43:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062171#M18560</guid>
      <dc:creator>dibeenapearl</dc:creator>
      <dc:date>2017-09-14T12:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062172#M18561</link>
      <description>&lt;P&gt;i think for that you will have to create seperate request since requestedfor is always inherited from request.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Sep 2017 12:49:18 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062172#M18561</guid>
      <dc:creator>gdd</dc:creator>
      <dc:date>2017-09-14T12:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062173#M18562</link>
      <description>&lt;P&gt;Thanks for the help. I am now able to show the user's name in the short description field.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I created a field (user) in the item and was wondering whether I can populate that field with the corresponding username along with the creation of tasks?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Dibeena&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 17 Sep 2017 23:18:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062173#M18562</guid>
      <dc:creator>dibeenapearl</dc:creator>
      <dc:date>2017-09-17T23:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062174#M18563</link>
      <description>&lt;P&gt;I have modified my script as below:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var a=current.variables.users.getDisplayValue();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var a_split=a.split(',');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;for(var i=0;i&amp;lt;a_split.length;i++)&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;{&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var gt=new GlideRecord('sc_task');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gt.initialize();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gt.short_description='task created: '+a_split[i];&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gt.description='task created for SAP access' +a_split[i];&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gt.request_item=current.sys_id;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gt.assignment_group.setDisplayValue('Client Support');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gt.parent = current.sys_id;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gt.start_date = current.u_request_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gt.due_date = current.due_date;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//fill user field with the correspondign user's name&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;current.variables.usr = a_split[i];&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//Can perform additional functionalities if u want&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gt.insert();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I used "current.variables.usr = a_split[i];" to fill my user variable of the task with relevant user's name, but it is filling up with the last selected user's name in all TASKS.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Will anyone be able to tell me on what I could be missign/doing wrong?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Dibeena&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Sep 2017 06:06:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062174#M18563</guid>
      <dc:creator>dibeenapearl</dc:creator>
      <dc:date>2017-09-18T06:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create multiple tasks for one catalog item</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062175#M18564</link>
      <description>&lt;P&gt;I have found the solution finally.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I was able to update each user's name in the short description.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I created the below client script which applies only to Catalog Tasks when the tasks are loaded&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;function onLoad() {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; //Type appropriate comment here, and begin script below&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; var desc = g_form.getValue('short_description');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var short_desc = desc.split(':');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setValue('usr',short_desc[1]);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;*******************************************************************&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I split the short description of the Task and copied the user's name on the field. It is getting updated accordingly.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;my short description was "Access requested for: Bailey Asher". I split with ':' and copied "Bailey Asher" to the catalog field "usr".&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Please close this conversation as "Answered" as I am not able to close it.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Dibeena&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Sep 2017 03:45:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/create-multiple-tasks-for-one-catalog-item/m-p/1062175#M18564</guid>
      <dc:creator>dibeenapearl</dc:creator>
      <dc:date>2017-09-21T03:45:23Z</dc:date>
    </item>
  </channel>
</rss>

