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 08:23 PM
Hope you are doing good.
Did my reply answer your question?
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-11-2025 01:39 PM - edited ā03-11-2025 01:39 PM
Hi @BanuMahalakshmi ,
It looks like the site value is empty. Please ensure that the value is not empty before splitting. Here is a script you can try:
var assignmentgroup;
var site = fd_data.trigger.request_item.variables.site;
var keyword = "";
var query = 'u_group_user=Group^u_contact_type=Local Support';
if(site){
keyword = site.split("-")[0].trim();
query += keyword+"" == "" ? "" : "^u_location=" + keyword;
}
var siteval = gs.getProperty('locations.with.network.lan.resource').split(',');
var index = -1;
index = siteval.indexOf(keyword);
if(index > -1)
{
assignmentgroup = '0e1285371b58c450c9307510cd4bcbed';
}
else
{
var assignmentgroup_val = new GlideRecord('u_location_point_of_contact');
assignmentgroup_val.addQuery(query);
assignmentgroup_val.query();
assignmentgroup_val.setLimit(1);
if (assignmentgroup_val.next()) {
assignmentgroup = assignmentgroup_val.u_group;
}
else
{
assignmentgroup = '0e1285371b58c450c9307510cd4bcbed';
}
return assignmentgroup;
}
If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.