Adding a Field Mapping Template with Groovy Code: Example

Groovy is a java-compliant scripting language used to customize the processing of objects and fields in Gateway. Use Groovy expressions to manipulate objects and fields in:

This example shows how to add a new field mapping template containing Groovy code.

Prerequisites

You have configured Primavera Gateway with P6 and Sample deployments.

Procedure

To create a new field mapping template with Groovy code for a Resource business object in P6:

  1. In the sidebar, select Configuration.
  2. Select the Field Mapping Templates tab.
  3. From the Select Business Object list, select Resource, and then select Add....
  4. In the General step:
    1. Enter a Template Name, Groovy Field Mapping for Resource.
    2. Select Template Type as Groovy.
    3. Select Provider 1 as Sample.
    4. Select Provider 2 as P6.
    5. Select Object 1 as Resource.
    6. Select Object 2 as Resource.
  5. In the left pane of the Mappings step, the source fields are in the Sample provider, and the target fields are in the Gateway:
    1. Select the Direction as Provider 1 (Sample) to Gateway.
    2. Select Employee Name from the Source Fields list.
    3. Select Name from the Target Fields list.
    4. In the Groovy Expression text box, enter the following code:

      if (containsField("EmployeeName"))

      {

      {Name} = [EmployeeName].toUpperCase();}

      }

    5. Select Validate Expression to ensure the syntax is valid.
  6. In the right pane of the Mappings step, the source fields are in the Gateway and the target fields are in the P6 provider:
    1. Select the Direction as Gateway to Provider 2 (P6).
    2. Select Name from the Source Fields list.
    3. Select Name from the Target Fields list.
  7. In the Summary step, review all selections and select Save.

    The Groovy Field Mapping for Resource template will now be available in the Field Mappings tab of the Project Data page for the Resource object.

Tips

Step me through...

Adding a Custom Field and Field Mapping Template: Example

Adding a Field Mapping Template for a CSV File: Example

Learn more about...

Adding or Editing Field Mapping Templates



Legal Notices | Your Privacy Rights
Copyright © 2013, 2022

Last Published Thursday, October 6, 2022