0% found this document useful (0 votes)
3 views

Grrovy_Setting_User_Variable

This document discusses the use of Groovy scripting in Oracle Cloud EPM applications to set default values for user variables, specifically focusing on the MyRegion variable for the Region dimension. It outlines a script that checks if the user variable is null, retrieves available region members based on user security, and sets the variable accordingly. The blog emphasizes the importance of using documentation and provides a link for further reference, along with a call to action for assistance with Groovy scripting.

Uploaded by

ramu939
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Grrovy_Setting_User_Variable

This document discusses the use of Groovy scripting in Oracle Cloud EPM applications to set default values for user variables, specifically focusing on the MyRegion variable for the Region dimension. It outlines a script that checks if the user variable is null, retrieves available region members based on user security, and sets the variable accordingly. The blog emphasizes the importance of using documentation and provides a link for further reference, along with a call to action for assistance with Groovy scripting.

Uploaded by

ramu939
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Oracle Cloud EPM –

setting user variable


default values using
Groovy
December 21, 2023
Lydia Maksoud
Brovanture Senior Consultant
Groovy is a standard scripting language which is available in Oracle Cloud
EPM applications to allow dynamic customisation in multiple contexts around
the system. The availability of Groovy is dependent on the Oracle Cloud EPM
licensing; groovy scripting is available for Oracle Cloud EPM
Enterprise applications only.
As with all coding languages, use of the documentation is key and Oracle
have provided a brilliant scripting reference which can be found
here: https://docs.oracle.com/en/cloud/saas/applications-common/22b/
cgsac/groovy-basics.html
In this blog we will focus on setting user variable values using Groovy.
User variables are administered by individual users and can be used on
forms to show only relevant information to the specific user. It is useful to set
default values for users so that they can open forms which utilise the user
variables, without having to manually set them first.
In the below example, we will be using groovy to set a default value for
the MyRegion user variable, which is setup for the Region dimension. This
will pick up the first available region member for the user, depending on the
security for the user that runs the rule.

The below script performs the following steps:

1. Check whether the user variable has a value, or not (i.e. is null)
2. If null, then retrieve the Region dimension
3. Set member function to retrieve all Region members under
ALLREG (All Regions)
4. Check number of region members that user has security access
to
5. If members are available, set the MyRegion user variable to the
first available member
6. Print a line in the log to indicate the setting

if(operation.application.getUserVariable(‘MyRegion’).getValue()==null){
//MyRegion User Variable is not selected
Cube cube = operation.application.getCube(“FinPlan”)
Dimension dim = cube.getApplication().getDimension(‘Region’);
String memberfunction = ‘ALLREG,Descendants(ALLREG)’
def mems = dim.getEvaluatedMembers(memberfunction,cube)
if(mems.size()>0){

operation.application.setUserVariableValue(operation.application.getUserVar
iable(‘MyRegion’),mems[0])
println “MyRegion User Variable is selected to ” +
operation.application.getUserVariable(‘MyRegion’).getValue()
}
}
else {
println “MyRegion User Variable is selected to ” +
operation.application.getUserVariable(‘MyRegion’).getValue()
}

Save this script in a business rule, with a relevant name, making sure to
select the rule type as Groovy. Assign the business rule to a task list, or a
form in the navigation flow, for each user to run before opening any forms
which utilise the user variables.

Until next time.

Lydia

If you want help with Groovy we already have considerable experience of


using Groovy with many of our clients and can be contacted at the phone
number at the top of this page or via our contact page HERE.
I also blog on Blogspot HERE
Share this entry







You might also like