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

  1. Create a new EPM Cloud based connection.

  2. Provide a URL ending with /HyperionPlanning.

  3. Provide the Service Administrator credentials.

  4. Provide the Domain name.

  5. Click Validate to validate the connection.

  6. Click Save and Close.


    Creating EPM Cloud connection

    Groovy Script Example 1


    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

  1. Create a new Other Web Service Provider based connection.

  2. Provide the full URL with /HyperionPlanning/rest/v3/applications/<AppName>/jobs.

  3. Provide the User credentials to be used to execute the Groovy Rule.

  4. Click Save and Close.


Creating Groovy other web connection

Groovy Script Example 2


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.