Parsing reference data from input form screen

Robin Hearne
Tera Expert

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

8 REPLIES 8

@Robin Hearne 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I have tried .toString() previously but the output is as follows:

Robin:

I have also tried JSON.stringify() with the same results.

Juhi Poddar
Kilo Patron

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

Robin Hearne
Tera Expert

Here's a screenshot showing the configuration of the Input (sys_sg_input) record:

RobinHearne_2-1740930941910.png

 

Here's the section of the script where I'm trying to convert the results using different methods and logging the results:

RobinHearne_1-1740930909769.png

Here are the log entries:

RobinHearne_3-1740931191777.png