JSON format example for multi select field

anuannap123
Tera Contributor

I want to pass multiple values for multi select field in Multiple record Import using Import set api.

Can someone guide me the JSON example format for multi select field

1 ACCEPTED SOLUTION

Runjay Patel
Giga Sage

Hi @anuannap123 ,

 

It could be something like below.

{
  "u_name": "Test Record",
  "u_multi_select_field": "Option1,Option2,Option3"
}

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

View solution in original post

9 REPLIES 9

Pratiksha
Mega Sage
Mega Sage

{
"records": [
{
"u_name": "Laptop 1",
"u_technology_stack": "Java,Python,JavaScript"
},
{
"u_name": "Laptop 2",
"u_technology_stack": "Python,React,Node.js"
},
{
"u_name": "Laptop 3",
"u_technology_stack": "JavaScript,HTML,CSS"
}
]
}

 

Regards,

Pratiksha

Ankur Bawiskar
Tera Patron
Tera Patron

@anuannap123 

this should have been an easy requirement.

Not sure what you tried and what didn't work?

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

i am just looking for sample JSON format for multi select field. the format Runjay gave helped me.

PritamG
Mega Guru

{
"short_description": "Sample import for multi-select field",
"category": "Hardware",
"multi_select_field": "Value1,Value2,Value3"
}

Replace this with your actual multi-select field name.

The values are comma-separated without spaces between them.

Gaurav Shirsat
Mega Sage

Hello 

The JSON script include provides methods to create JSON objects from a string, and to turn JSON objects into strings.

https://www.servicenow.com/docs/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/...

if you have any JSON with you : you can copy-paste it in below link and first verify its correct or not?

https://jsonlint.com/

 

Refer my Sample Code for better understanding :

userDetails: function(){
var obj = {};//Object Created
var id = this.getParameter('sysparm_userID');
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', id);
gr.query();
if(gr.next()){

//key and value passed. obj[''<key>]=<value>
obj['email'] = gr.getValue('email');
obj['manager'] = gr.getValue('manager');
obj['location'] = gr.getValue('location');
obj['region'] = gr.region.toString();
}

 

Please find details about JSON Parse if needed :

The JSON.parse() method parses a string and returns a JavaScript object.

The string has to be written in JSON format.

The JSON.parse() method can optionally transform the result with a function.

 

Thanks and Regards

Gaurav Shirsat