Last active
June 22, 2021 06:06
-
-
Save chelnak/813167f381ab99acc1e6 to your computer and use it in GitHub Desktop.
A vRO Scriptable task that will parse a JSON Resource Element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//vRO Scriptable task to parse a resource element and | |
//edit values | |
//inputs: | |
//jsonTemplate : ResourceElement | |
//reservationName : String | |
//subtenantId : String | |
//outputs | |
//payload : String | |
//Get the content of the Resource Element | |
template = jsonTemplate.getContentAsMimeAttachment(); | |
//Use JSON.parse to parse content in to a useable object | |
jsonObject = JSON.parse(template.content); | |
//Now we can manipulate individual values, which makes the template dynamic | |
jsonObject['name'] = reservationName; | |
jsonObject['subTenantId'] = subtenantId; | |
//Convert object back to string ready to POST | |
payload = JSON.stringify(jsonObject); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment