Exercise - Add the Segment column in the Customers V3 (accounts) table map
In this exercise, you’ll:
- Extend the Dataverse data model and add a new custom table for Segment.
- Extend the Customers V3 (accounts) table map and add the Segment column in the mapping.
Scenario
Contoso Manufacturing Germany (DEMF) is a global manufacturer of home and auto electronics. Sales staffs generate leads, and they prepare and submit sales quotes and sales orders and maintain customer relationships.
In this exercise, you’ll be required to set up Dynamics 365 Sales, Dynamics 365 Finance, and Dynamics 365 Supply Chain Management apps with dual-write to ensure that the sales quotes aren’t integrated into Supply Chain Management without first being completed in Dynamics 365 Sales. You’ll complete this task by extending an existing table map to include an extra column. Then, you’ll use this column to filter the quotes that are completed for integration.
Prerequisites
Exercise - Install dual-write is a prerequisite for the exercises in this module. The following apps/solutions must be installed:
- Finance and operations apps environment with standard Contoso demo data
- Dynamics 365 Sales
- Dual-write core solution
- Dual-write application orchestration solution (dual-write must be set up as outlined in System requirements and prerequisites.
Additionally, make sure that the legal entity DEMF is linked between Customer Engagement and finance and operations apps.
Ensure that the following table maps are enabled and have been synchronized from finance and operations apps to Dataverse:
- Customers V3 (accounts)
- Payment schedule
- Payment days CDS
- Terms of payment
- Customer groups
- Sales tax groups
- Customer payment method
- Currencies
Extend the Dataverse data model
finance and operations apps includes the Segment table, which is available as a field in the Customer record. That column isn’t available in Dynamics 365 Sales. The scope of the exercise is to extend the Dataverse data model to add this column on the Account table.
The following steps explain how to extend the Dataverse data model. First, you should sign in to the Power Apps maker portal.
Select the correct Dataverse environment in the top bar.
Go to Solutions and create a new one.
For this exercise, leave Default Publisher selected; however, always consider selecting your own publisher in a real customization scenario.
Select the recently created solution and then create the new Segment table.
- Enter Segment in the New table Display name field.
- Enter Segment code in the Primary Name column.
- Select Create.
Select the Segment table and then select Add column to create two columns: Description, Text Data type and Company, Lookup Data type. Make sure that you extend all company-specific tables (system or custom) so that they have a many to-one (N:1) relationships with the cdm_Company table.
Select Save Table to save the changes.
Create the alternate key, which allows an integration key to be automatically created after you’ve created a dual-write table map.
- Select the Keys tab.
- Select Add key.
- Enter SegmentKey in the Display name field.
- Select the Company column.
- Select the Segment code column.
- Select Done.
Add the new Company and Description columns in the Segment Information main form and following views:
- Active Segments
- Inactive Segments
- Segment Lookup View
Add the Account table to the solution.
- Select the Exercise1_SegmentExtension solution and then select Add existing.
- Select Table > Account and then select Next.
- Leave the Include all components and Include table metadata checkboxes cleared and then select Add.
Add the Segment Lookup column to the Account table.
- Select Add column.
- Enter Segment in the Display name field.
- Select Lookup in the Data type field.
- Select Done.
- Select Save Table.
Add the Segment column to the Account table main form.
- Add the Account main form to the solution.
- Select the Account form by going to Account table > Forms tab.
- In the form designer, add the Segment column.
- Select the Form field.
- Drag the Segment column from the left panel and drop it in the form under the Customer Group ID column.
- Select Save.
On the Segment column, apply filtering based on the company context, and then select the Switch to classic form in the form designer.
Select Save and Close.
Select the solution in the Power Apps maker portal and then select Publish all customizations.
Verify that the changes have been applied.
- Sign in to your Dataverse sales app.
- Select an account row to view the changes in the form.
Extend the Customers V3 (Accounts) table map
To extend the Customers V3 (Accounts) table map, follow these steps.
- Sign in to finance and operations apps.
- Go to Workspaces > Data management and then select the Dual-write tile.
- From the Dual-write table maps list page, complete these steps:
- Find the Customers V3 (accounts) table map.
- Select the map from the list.
- Select Stop.
- Select Customers V3 (accounts), select the Save As button, and then save the new table map.
- Select Customers V3 (accounts) and then select Refresh tables to update the Dataverse metadata.
- Select Add mapping to add a new column mapping.
- Select None on the left, select the SALESSEGMENTID column, and then select OK.
- Select None on the right, select the new_segment.new_segmentcode [Segment (Segment code)] column, and then select OK. You can filter the columns by entering your text.
- Select Save to save the changes and then return to the Dual-write table map list by selecting Dual-write.
- Select Integration key.
- Scroll to find the Segment row, and then verify that the integration key has been created from the Dataverse alternate key that you created previously.
- From the Dual-write table map list, select Add table map.
- Select the Business segments table on the Finance and Operation apps table and the Dataverse table, and then provide information in the Publisher, Version, and Description fields.
- Select Save.
- Select the new table map that you created and then add the columns.
- Map the SEGMENTCODE column from finance and operations apps to the new_segmentcode column on the Dataverse side.
- Map the SEGMENTDESCRIPTION column from finance and operations apps to new_description column on the Dataverse side.
- Find and select Business segments (new_segments) in the dual-write table maps list and then select Run.
- Select the Initial sync option and then set the master for initial synch as finance and operations apps.
- Select Run.
- Verify that the segments have been synched in Dataverse. Go to Dynamics 365 Sales and use the Advanced Find feature to retrieve the segment rows.
- Find and select Customer V3 (accounts) in the dual-write table maps list and then select Run.
- Select the Initial sync option and then set the master for initial synch as finance and operations apps.
- Select Run.
- Test your changes. Change a customer’s segment value and verify that the change syncs between the two applications.