Executing Financial Consolidation and Close Seeded Rules Using Groovy Script
On-Demand Rules (ODR) allow calculations to be executed outside of the consolidation or translation process. This is useful for situations where a total consolidation is not needed for the business requirement. On-Demand Rules are also very efficient and can be very useful for quick calculation needs. The examples below show how you can write a Groovy script rule using an On-Demand Rule.
Approach 1 - Using EPM Cloud-Based Named Connections
-
Create a new EPM Cloud based connection.
-
Provide a URL ending with
/HyperionPlanning
. -
Provide the Service Administrator credentials.
-
Provide the Domain name.
-
Click Validate to validate the connection.
-
Click Save and Close.
Groovy Script Example 1
/*RTPS: {Scenario} {Years} {Period} {Entity}*/
String sScenario = rtps.Scenario.toString()
String sYears = rtps.Years.toString()
String sPeriod = rtps.Period.toString()
String sEntity = rtps.Entity.toString()
HttpResponse<String> jsonResponse = operation.application.getConnection("Consolidation Application").post("/rest/v3/applications/<AppName>/jobs")
.header("Content-Type", "application/json")
.body(json(["jobType" : "Rules", "jobName" : "Translate",
"parameters":
[
"Currency":"USD_Reporting",
"Scenario":"${sScenario}",
"Entity":"${sEntity}",
"Year":"${sYears}",
"Period":"${sPeriod}"
]
])).asString()
Approach 2 - Using Other Web Service Provider Named Connections
-
Create a new Other Web Service Provider based connection.
-
Provide the full URL with
/HyperionPlanning/rest/v3/applications/<AppName>/jobs
. -
Provide the User credentials to be used to execute the Groovy Rule.
-
Click Save and Close.
Groovy Script Example 2
/*RTPS: {Scenario} {Years} {Period} {Entity}*/
String sScenario = rtps.Scenario.toString()
String sYears = rtps.Years.toString()
String sPeriod = rtps.Period.toString()
String sEntity = rtps.Entity.toString()
HttpResponse<String> jsonResponse = operation.application.getConnection("Jobs").post()
.header("Content-Type", "application/json")
.body(json(["jobType" : "Rules", "jobName" : "Translate",
"parameters":
[
"Currency":"USD_Reporting",
"Scenario":"${sScenario}",
"Entity":"${sEntity}",
"Year":"${sYears}",
"Period":"${sPeriod}"
]
])).asString()
After you create Connections using one of the above approaches, you can execute Groovy-based rules from the Rules card, or Jobs, or using EPM Automate.