Introduction
This 20-minute tutorial shows you how to create a Groovy script to work with Planning metadata, in this case, moving a member from one parent to another. The script includes RTPs to prompt users for input. You'll also learn how to create a right-click action menu with a menu item to call the script, and how to associate the action menu with a data form. Complete the sections in order.
Background
The EPM object model in Groovy gives you tools to design interactive ways for users to work with metadata, such as adding new members, renaming existing members, moving members under new parents, updating other metadata properties, and so on. Including run time prompts, or RTPs, in your Groovy scripts lets you prompt users for relevant values during these operations.
The EPM object model provides utility methods to perform the following tasks:
- Retrieve the object representations for the various types of RTPs such as Member, Members, DateAsNumber, Member Range, and so on
- Validate RTP values and veto the rule execution if the provided values are not valid
Prerequisites
Cloud EPM Hands-on Tutorials may require you to import a snapshot into a Cloud EPM Enterprise Service instance. A snapshot cannot be imported over an existing application or business process. Before importing the snapshot, use a separate Cloud EPM Enterprise Service instance or remove the existing application or business process from the instance you plan to use. Importing the snapshot does not automatically replace or restore existing content.
Before starting this tutorial, you must:
- Have Service Administrator access to a Cloud EPM Enterprise Service instance.
- Upload and import this snapshot into your instance. This snapshot requires the Planning business process. If you have already imported the snapshot for another Groovy tutorial, you can continue using that application without importing the snapshot again.
Note:
If you run into migration errors importing the snapshot, re-run the migration excluding the HSS-Shared Services component, as well as the Security and User Preferences artifacts in the Core component. For more information on uploading and importing snapshots, refer to the Administering Migration for Oracle Enterprise Performance Management Cloud documentation.Tip:
The scripts you need for this tutorial are linked as text files within each section.Loading Planning Calculation Variables
In this section, you upload calculation variables from an XML file for use in the Groovy script.
- Right-click the link for HP4_Plan2_Variables.xml, and save the file to your local drive.
- From the Home page, click
(Navigate), then, under Create and Manage, click Rules to open Calculation Manager.

- On the System View tab, expand EPM Cloud, then HP4. Right-click Plan2 and select Import.

- Under File Import Details, browse to select HP4_Plan2_Variables.xml from your local drive.
- Under Location Details, make the following selections:
- Application Type: EPM Cloud
- Application: HP4
- Cube: Plan2

- Under Import Options, verify that Override Existing Objects is selected. This option is selected by default.
- Click Import. Review the import results (they may say Inserted or Updated), and then click OK.

- Click Cancel to close the Import dialog box.
Creating a Groovy Script to Move Dimension Members
In this section, you implement a Groovy script to move an employee from one parent to another. We'll work with the predefined ManageEmployees form, which has been set up to capture employee information such as their Grade, Salary, Bonus, Phone, Email, Address, and Reporting Manager.

- In Calculation Manager, expand Plan2. Right-click Rules and select New.

- For Name, enter
Groovy Move Employee, then click OK.
- In the Rule Editor, change the Designer option to Edit Script and set the Script Type to Groovy Script.

- Copy this script and paste it into the editor:
/*RTPS: {Employee} {NewParent}*/
def employee = rtps.Employee.member
def newParent = rtps.NewParent.member
employee.dimension.saveMember(["Member" : employee.name, "Parent" : newParent.name] as Map<String, Object>)
Define all the run time prompts used by this rule on the first line.
Get the Member object for the employee specified by the Employeerun time prompt. The codertps.Employeereturns anRtpValueobject for the Employee run time prompt, whereasrtps.Employee.memberinstructs theRtpValueobject to return a Member object, which is what is required here.
Get the Member object for the new parent specified by the NewParentrun time prompt. The codertps.NewParentreturns anRtpValueobject for the NewParent run time prompt, whereasrtps.NewParent.memberinstructs theRtpValueobject to return a Member object, which is what is required here.
Save the employee under the new parent.
The code employee.dimensioninstructs the employee Member to return its Dimension object. So the full statementemployee.dimension.saveMember()instructs the Dimension object to save the member with the specified property values, in this case the new parent.Note:
This is a privileged method and will throw an exception if called by a user that does not have administrator privileges. - On the toolbar, click
(Save) to save the script. At the information message, click OK.
- Click
(Validate and Deploy). For validation purposes, enter the following RTP values:
- Employee:
"Employee 3" - NewParent:
"Part Time Employees"

- Employee:
- Click OK to validate and deploy the rule, then click OK to close the information message.
Note:
During this step, the rule is not executed; however, you must enter valid members for the validation process to succeed.
- Close Calculation Manager and return to the Planning browser window.
Creating Planning Action Menus to Run Groovy Scripts
In this section, you create an action menu called Manage Employees, with a right-click action menu item that runs the Groovy script.
- In Planning, click
(Navigator), then, under Create and Manage, click Action Menus.
Note:
If you've completed other Groovy tutorials, the Manage Employees action menu may already exist. If it does, please proceed to step 4. - Click
(Create Menu) to add an action menu.

- For Menu Name, enter
Manage Employees, then click OK.
- Click
(Add Child). Enter or select the following values:
Option Field Value to Enter or Select Menu Item Move EmployeeLabel Move EmployeeType Business Rule Required Parameters Employee Cube Plan2 Business Rule Groovy Move Employee 
- Click Save. At the confirmation message, click OK.

- Click Save to save the action menu. At the confirmation message, click OK.


Associating Planning Action Menus with Forms
In this section, you associate the Manage Employees action menu with the ManageEmployees form.
- Click
(Navigator), then select Data. - Click ManageEmployees to open the form.

- Click Actions, then select Edit to edit the form.
A new dynamic tab is displayed with the form editor.

- Select the Other Options tab.

Note:
If you've completed other Groovy tutorials, the Manage Employees action menu may already be associated with the form. If it is, please close the Edit ManageEmployees tab and proceed to the next section, Testing the Groovy Script. - Add Manage Employees to the Selected Menus list, then click Save.

- Click OK to close the information message.

- At the bottom of the page, close the Edit ManageEmployees dynamic tab to return to the data form.
Testing the Groovy Script
In this section, you run the rule from the ManageEmployees form to move employees.
To test the Groovy script, move Employee 3 to the Part Time Employees parent:
- Right-click Employee 3 and select Move Employee.

- Verify that "Employee 3" is selected for the Select Employee prompt.

- For the Employee New Parent prompt, enter
"Part Time Employees".
- Click Launch. At the information message, click OK.

Upon successful completion, Employee 3 is moved to the Part Time Employees parent.

- Now, reverse the move: Right-click Employee 3, then select Move Employee.
- Verify that "Employee 3" is selected for the Select Employee prompt.

- For the Employee New Parent prompt, enter
"Full Time Employees".
- Click Launch. At the information message, click OK.

Employee 3 is moved back to the Full Time Employees parent.

Note:
After executing this rule, you need to perform a cube refresh so that aggregations properly reflect the new hierarchies.
Related Links
- Planning Tutorials — Select Implementing Groovy from the area-of-interest list to explore additional Groovy tutorials.
- Java API Reference for Groovy Rules — Explore the Groovy APIs available for developing Groovy rules and templates.
- REST APIs for Oracle Fusion Cloud EPM — Explore the REST APIs available for managing and automating Cloud EPM tasks.
More Learning Resources
Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.
For product documentation, visit Oracle Help Center.
Moving Dimension Members with Groovy
F87328-02
November 2026
