how to Map the choice variable dynamically in flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 08:33 PM
Hi All,
I am trying to map the choice field of a snow user profile through flow designer. we get user data through an integration and value should be mapped to field in snow user profile dynamically based on the input we receive as we have different choice values in snow end. trying with below script but it is returning empty value:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 08:57 PM
/*
**Access Flow/Action data using the fd_data object. Script must return a value.
*/
var empType = fd_data._1__get_employee_data__snaplogic.employee_type;
var fte = 'full_time_employee';
var con = 'contractor';
var ctg = 'contingent';
if (empType) { // Check if empType is defined and not null
if (empType === "Employee") {
return fte;
} else if (empType === "Contractor") {
return con;
} else if (empType === "Contingent") {
return ctg;
} else {
return ''; // Return empty if no match found
}
} else {
return ''; // Return empty if empType is undefined or null
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 08:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 09:09 PM
This indicates that you have not defined the output variable employee_type in
get_employee_data__snaplogic
action or if you have defined the output variable, check the variable name. Use dot-walking to get the variable value while scripting.
Can you please share your action configurtion?
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2025 09:18 PM
it means you are not taking the value correctly
Please share complete flow steps along with screenshot
Is that flow on catalog and that is a variable?
If yes then you should use Get Catalog Variable action and then dot walk and get that variable value
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
01-26-2025 10:27 PM
Hi @Ankur Bawiskar here is the action details that we have configured.
script step :
outputs:
As per the error, it is mentioned that employee_type in output is not defined
when we tested the action , we got employee_type details in output message[string] as below:
We wanted to add this update to already exisiting configuration and mapped as same as per existing.