You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Using groovy to set substitution variables for non admin users - REST API connection issue

Summary:

when we run below business rule, getting below error message, could you please check and update us.

"Details: A method called by the script failed on line: 40, with error: Error occurred: UNAUTHORIZED"


import groovy.json.JsonOutput
/*RTPS:1 {FCMthValue}*/
/*RTPS:2 {ActMthValue}*/

// Extracting RTP values
String varvalue1 = rtps.FCMthValue.enteredValue
String varvalue2 = rtps.ActMthValue.enteredValue

// Constructing URL for REST request
def Vaccines = operation.application.getConnection("Vaccines").getUrl() + "/HyperionPlanning/rest/v3/applications/Vaccines/plantypes/Input/substitutionvariables"

// Constructing JSON body for the REST request
def requestBody = JsonOutput.toJson([
items: [
[
"name": "FCMonthSpread",
"value": varvalue1,
"planType": "Input"
],
[
"name": "Actmonth",
"value": varvalue2 ,
"planType": "Input"
]
]
])

// Making POST request to update substitution variables

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!