- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 10:01 AM - edited 06-07-2024 10:08 AM
Hello,
I need to map variables to description on Catalog Task but I tried using scripted option but keeps erroring out. What is the syntax for this. Any assistance is appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 09:15 PM
Hi @purdue could you please also check the semicolon at the line 3. I missed it. it should be like below
var desc = [];
Let me know if it is working or will find another solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 10:48 AM
Hi Purdue,
I can see a few things that might make things work:
I'm assuming that fd_data is something defined which includes a function 1__get_catalog_variables. In that case the syntax would be
desc = fd_data.1__get_catalog_variables("requested_for);
If you have global selected for your relevant variables in the item definitions, they will show up on the task automatically. If you use that, then you can just use current.variables.<variable name> as part of setting desc.
You are missing an = after var desc, so nothing will assign.
Even with the above corrections, if everything works, your result in desc will only show provide_details_for _your_update because you are redeclaring desc in each statement. The assignments should look like this
var desc = "Requested for: " + fd_data.1__get_catalog_variables("requested_for);
desc = desc + "Manager" " + fd_data.1__get_catalog_variables(manager");
.
.
.
return desc;
Which will give you the string with the variables and labels.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 06:35 AM
Thanks John for responding. Unfortunately this did not work. I was able to get this to stop erroring out but still not getting the results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 06:49 AM
Hi purdue,
Please make this little change:
var hold = fd_data._1__get_catalog_variables.requested_for.getDisplayValue();
It looks like requested_for is a reference. If that's the case, you need to get the display value. If it's a more complex object, you will need to extract the property within it that you need.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 10:12 AM
Requested for is fine the issue is for select box variables. Without custom action you cannot get the display value.