can not read the property 0 from undefined into flow design
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-11-2025 07:37 AM
Hi
I am getting the error message "cannot read the property 0 from undefined" while assign value into flow design task assignment group stage. please let me know correction in the script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-11-2025 07:44 AM
As I mentioned in the previous thread, use Get catalog variable action instead of using request_item.variables.
Then, lookup group record by passing the sys_id and finally use the assignment group record obj in the create catalog task action.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-11-2025 07:44 AM
The error āCannot read property ā0ā from undefinedā typically occurs because the script tries to access an index (0) of an undefined or null value. In your case, this happens while executing:
var keyword= site.split("-")[0].trim();
Before using .split("-"), ensure the site is defined and not empty.
Please mark it helpful
Priyatam Patchipulusu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-11-2025 07:46 AM
Hello @BanuMahalakshmi
It's happening. Because your site is not having any value and you are trying to read (0) index from it.
Please create additional step in flow designer to get Catalog variables and then reference that flow step to access the value of site and also convert it to string to or access name directly to traverse 0 index.
Kindly mark my answer as helpful and accept solution if it helped you in anyway,
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwN
eEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-11-2025 08:31 AM
it's because of these lines
var site = fd_data.trigger.request_item.variables.site;
var keyword= site.split("-")[0].trim();
Take this approach
1) use Get Catalog Variables flow action
2) then use IF flog logic to see if that variable is not empty
3) then within that IF have create catalog task with that script and access the variable value like this
Get Catalog Variable->VariableName
OR
1) Create a flow variable of type string
2) use Get Catalog Variables flow action
3) then use Set Flow Variable logic and use script to determine the group and return the sysId and store in flow variable
4) then use that flow variable during your catalog task creation while assigning
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader