Parsing reference data from input form screen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2025 06:00 AM
I have created an Input form screen with a Reference input which allows multiple selections and I'm having issues accessing the sys_ids of the selected records in my Query condition script.
The Input type for the Input record is 'Reference'. The Type of the Data parameter is 'String.
When I log the input value to the system log it appears similar to the following:
[Ljava.lang.String;@690ecd97
From my research I believe that this means that it is an array of class java.lang.String but I have not been able to find any way to convert this into a regular array or indeed any other output that enables me to read the contents of the array.
I wonder if it's occurring because of the type mismatch between the Input and the Data parameter but there aren't any obvious alternatives.
Is any one able to tell me how to resolve this?
Thanks in advance.
Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 02:05 AM
can you try this?
var plan= input.maintenance_plan.toString();
gs.info('Robin: ' + plan);
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
02-24-2025 02:14 AM
I have tried .toString() previously but the output is as follows:
Robin:
I have also tried JSON.stringify() with the same results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 02:46 AM
Hello @Robin Hearne
Could you please share some screenshots and the script that you have tried. It will help us to analyze the problem more effectively.
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2025 08:05 AM
Here's a screenshot showing the configuration of the Input (sys_sg_input) record:
Here's the section of the script where I'm trying to convert the results using different methods and logging the results:
Here are the log entries: