This example shows how to create field mapping templates for conditionally converting Roles to Resources in Gateway using flexible object mapping.
Scenario:
An organization wants to perform a 1-1 Role conversion from Sample to P6 with the exception: all software development roles that contain the RoleId, "DEV" must be created as Resources in P6 instead. To ensure all roles in Sample are either converted to Resources or retained as Roles in P6 based on the condition, you will need to create a field mapping template on the destination side, in this case, Gateway , for the Role and the Resource objects as follows:
- In the Role field mapping template, specify a condition to ensure that all roles that do not contain the RoleId, 'DEV' are converted to Role in the destination provider (Gateway and P6).
- In the Resource field mapping template, specify a condition to ensure that only those Roles that contain the RoleId 'DEV' are converted to Resource in the destination providers (Gateway and P6).
Note: By creating the two templates, you ensure that all the roles are processed from Sample. From a total of ten roles, if three RoleIds contain the string "DEV", they get converted to Resources. The remaining seven Roles that don't meet the criteria continue to be created as Roles in the destination provider.
Prerequisites
- You have configured Primavera Gateway with P6 and Sample deployments.
- Sample is the source provider and P6 is the destination provider.
- Sample contains Roles with Role Ids with the string, "DEV".
- Coding changes have been made in the Sample provider (source) to support the new object mapping listed below:
- Sample > Gateway > P6
- Role > Resource > Resource .
Procedure A - Create a Mapping Template for Resource Object
Create a new field mapping template for the Resource business object on the destination side (based on the object mapping, Gateway and P6) to conditionally convert RoleIds containing "DEV" to Resources as follows:
- In the sidebar, select Configuration.
- Select the Field Mapping Templates tab.
- From the Select Business Object list, select the business object on the destination side, Resource, and then select Add....
- In the General step of the Template wizard:
- Enter a Template Name, Role To Resource Object Mapping Template.
- Select Template Type as Direct.
- Set Provider 1 as Sample.
- Set Provider 2 as P6.
- Select Object 1 as Role.
- Select Object 2 as Resource.
- Select Use Criteria Step to define the condition for converting Roles to Resources.
- In the Criteria step, enter the condition to select only roles that contain the string "DEV" in Sample (source) and P6 (destination) as follows:
- In the Provider 1: Sample section, select the the fields and enter a condition as follows:
- In the Fields field, select RoleId for the Role business object.
- In the Condition dialog box, enter the condition:
return [RoleId].startsWith("DEV");
- Select the Validate Condition to confirm.
- In the Provider 2: P6 section, select the down-arrow button to select the fields.
- In the Fields field, select Id for the Resource business object.
- In the Condition dialog box, enter the condition:
return [Id].startsWith("DEV")
- Select the Validate Condition to confirm.
- In the Provider 1: Sample section, select the the fields and enter a condition as follows:
- In the Mappings step, enter field mappings between Sample, Gateway, and P6 that needs to be created by the template.
- Select the following business object and field in each provider:
Sample: Select RoleName and RoleId.
Gateway: Select Name and Id.
P6: Select Name and Id.
- Select Add.
- Select the following business object and field in each provider:
- In the Summary step, review the template summary and select Save or select Back to update the field mapping template.
The Role to Resource Object Mapping Template will now be available in the Field Mappings tab of Gateway's Resource object in the Business Flow wizard.
Procedure B - Create a Mapping Template for Role Object
Create a second field mapping template for the Role business object on the destination side (based on the object mapping, Gateway and P6) for a 1-1 mapping for those RoleIds in Sample that do not contain "DEV".
- In the sidebar, select Configuration.
- Select the Field Mapping Templates tab.
- From the Select Business Object list, select Role, and then select Add...
- In the General step of the Template wizard:
- Enter the Template Name, Role To Role Object Mapping Template.
- Select Template Type as Direct.
- Set Provider 1 as Sample.
- Set Provider 2 as P6.
- Select Object 1 as Role.
- Select Object 2 as Role.
- Select Use Criteria Step to define the condition for Roles that cannot be converted to Resources.
- In the Criteria step, enter the condition to select only roles that do not contain the string "DEV" as follows:
- In the Provider 1: Sample section, select Click to Choose.
- Pick the fields RoleId in the Role business object that will be used to specify the condition, and then select Add Fields.
- In the Condition dialog box, enter the following condition:
return
![RoleId].startsWith("DEV");
- Select the Validate Condition to confirm.
- In the Provider 2: P6 section, select Click to Choose.
- Pick the fields Id in the Role business object that will be used to specify the condition, and then select Add Fields.
- In the Condition dialog box, enter the following condition:
return
![Id].startsWith("DEV")
- Select the Validate Condition to confirm.
- In the Provider 1: Sample section, select Click to Choose.
- In the Mappings step, enter the field mappings between Sample, Gateway and P6 that needs to be created by the template.
- Select the following business object and field in each provider:
Sample: Select RoleName and RoleId
Gateway: Select Name and Id.
P6: Select Name and Id.
- Select Add.
- Select the following business object and field in each provider:
- In the Summary step, review the template summary and select Save or select Back to update the field mapping template.
The Role to Role Object Mapping Template will now be available in the Field Mappings tab of Gateway's Role object in the Business Flow wizard.