Output variable showing as {"variable":["[object ScopedGlideRecord]"]} instead of the choice value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2024 02:49 AM
I have a requirement to create tasks based on the list of values in the List datatype field. This field has got static values added as choices. I have created an action to convert the choice list values in to a string array as per Ankur's post https://community.servicenow.com/community?id=community_blog&sys_id=e244e902dbcc2010fb4ae15b8a9619c3
I'm getting this output in the variable while looping through the string variables as "{"variable":["[object ScopedGlideRecord]"]}". Not sure what's wrong here, but if i execute the action separately I could see the comma separated values has been put in to an array correctly. There are currently two values in my choice list and I'm trying to add those values as the subject of my task. Only one task is created instead of two and ""{"variable":["[object ScopedGlideRecord]"]}" is being set in my task subject.
Screenshot attached.
Appreciate any help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2024 10:09 PM
I believe your issue is to do with your input data type - it's a string but you really need to it be a List type.
The issue with that though is that ServiceNow doesn't let you pick a generic List type, it has to be a list that references a table, and since your List field type doesn't do that (as you just have sys_choice records), it doesn't look like you can get the List input type in the action to work.
You may need to instead resort to inputting your entire record into the action as your input (rather than just the list field), and then accessing the list's values from the record input instead within your script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 06:09 PM
Is there any sample script that you could provide?