Customizing a Field Mapping Template with Groovy Code: Example

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

Prerequisites

Procedure

For the purposes of this example, let's assume that you want to create a new field mapping template with Groovy code for a Resource business object in P6:

  1. Select Configuration.
  2. Select Customization.
  3. Select a business object, Resource, from the drop-down and select Add.
  4. On the General tab:
    1. Enter a Template Name, Groovy Field Mapping for Resource.
    2. Select Groovy as the Template Type.
    3. Set Provider 1 as Sample
    4. Set Provider 2 as P6.
  5. On the left pane of the Mappings tab:
    1. Select the Direction for Provider 1 as Sample to Gateway.
    2. In the Source Fields, select Employee Name from the drop-down, scroll down and select Select Fields.

      Note: In this case, the source fields are in the Sample provider, and the target fields are in the Gateway provider.

    3. In the Target Fields, select Name from the drop-down, scroll down and select Select Fields.

      Note: In this case, the target fields are in the Gateway provider

    4. In the Groovy Expression text box, enter the following code:

      if (containsField("EmployeeName"))

      {

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

      if (containsField("SampleDate")) {

      def cal = new GregorianCalendar();

      cal.setTime([SampleDate]);

      cal.add(Calendar.DATE, -1);

      cal.add(Calendar.HOUR, 2);

      {Name} = cal.getTime();

      }

    5. Select Validate Expression to ensure the syntax is valid.
  6. On the right pane of the Mappings tab:
    1. Select the Direction for Provider 2 as Gateway to P6.
    2. In the Source Fields, select Name from the drop-down, scroll down and select Select Fields.

      Note: In this case, the source fields are in the Gateway provider, and the target fields are in the P6 provider.

    3. In the Target Fields, select Name from the drop-down, scroll down and select Select Fields.

      Note: In this case, the target fields are in the P6 provider.

  7. On the Review & Submit tab, review the summary and select Save.

Related Topics

Setting up Primavera Gateway

Configuring Primavera Gateway Settings

Adding an Application Deployment Connection

Adding or Customizing Field Mapping Templates

Exporting Field Mapping Templates

Exporting Field Mapping Templates: Example

Importing Field Mapping Templates

Importing Field Mapping Templates: Example



Legal Notices
Copyright © 2013, 2015, Oracle and/or its affiliates. All rights reserved.

Last Published Friday, March 27, 2015