How to convert a String type value to a List type in Flow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 01:44 AM
Hi, I am a newbie to ServiceNow and I would like to know if there is any knowledge that can help me.
In my Subflow, I have created an action "Create Record" in flow #1 and "Update Record" in flow #2.
In #1 I specify the table "Test product table" and in the SysID I put the Flow Variables "newSysID" of type String that I created.
In #2, the table "Test common table" is specified, and a column "List test column" of type List is specified in the field.
The column "List test column" contains comma-separated strings.
In #2, I want to put the SysID of each record created in #1 in column "List test column".
I am trying to achieve this with the Expand Script in Update Record, but it is not working.
I would like to know if there are any additional actions needed or specific scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 06:00 AM
I'm not sure I 100% understand the process in your flows, but at a high level list fields are actually captured in the backend with the sys_ids in a comma separated string. So, something like 2334234,0980980809,3432452342. Depending on how you call the update and pass the sys_ids that were created:
- If you need to add the sys_id to the already existing value on the record, you need to first query the record to get the current value, then you can do something like (pill for current value) + ',' + (new sys id pill)
- If you have all the sys_ids available in the subflow, then you could just join them like above in a script to set the value
If I'm missing the ask or your scenario, just let me know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 01:26 AM
I guess you want to pull sys_id and make it comma delimited?
I think this will help you.