- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2021 11:30 PM
hello all,
add multiple fields in system properties and send that field when rest message is called.means want to send dynamic field name in integration.
please help
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2021 12:04 AM
If you have nested data object in your responseBody then you can use something like this:
var fields = gs.getProperty('propertyName').split(',');
for (var index in fields) {
var field = fields[index];
customBodyObject.data[inputs] = current.getValue(field); //here customBodyObject is object that your are preparing and data is abother object in your jsonBody. current is GlideRecord obj
}
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2021 11:56 PM
Hi,
you can create system property to hold comma separated values.
but what exactly is required here once you get the system property value using gs.getProperty
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2021 11:56 PM
Hi,
You have to pass something like this in ur script include to make it work in REST
Below is the example of JIRA
r.setStringParameter('base_endpoint', gs.getProperty('com.snc.integration.jira.base_jira_instance_url'));
Please mark my answer as Correct & Helpful, if applicable.
Thanks
Sandeep

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2021 12:00 AM
Hi,
You can use comma separated list as value in system property and use it in your script while preparing response/request body.
var fields = gs.getProperty('propertyName').split(',');
for (var index in fields) {
var field = fields[index];
respBodyObj.setValue(field, current.getValue(field)); //here respBodyObj is object that your are preparing and urrent is GlideRecord obj
}
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2021 12:04 AM
If you have nested data object in your responseBody then you can use something like this:
var fields = gs.getProperty('propertyName').split(',');
for (var index in fields) {
var field = fields[index];
customBodyObject.data[inputs] = current.getValue(field); //here customBodyObject is object that your are preparing and data is abother object in your jsonBody. current is GlideRecord obj
}
Thanks,
Anil Lande
Thanks
Anil Lande