Exercise - Add the Segment column in the Customers V3 (accounts) table map

Completed

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.

  1. Select the correct Dataverse environment in the top bar.

  2. 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.

  3. 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.
  4. 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.

  5. Select Save Table to save the changes.

  6. 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.
  7. Add the new Company and Description columns in the Segment Information main form and following views:

    • Active Segments
    • Inactive Segments
    • Segment Lookup View
  8. 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.
  9. 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.
  10. 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.
  11. On the Segment column, apply filtering based on the company context, and then select the Switch to classic form in the form designer.

  12. Select Save and Close.

  13. Select the solution in the Power Apps maker portal and then select Publish all customizations.

  14. 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.

  1. Sign in to finance and operations apps.
  2. Go to Workspaces > Data management and then select the Dual-write tile.
  3. 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.
  4. Select Customers V3 (accounts), select the Save As button, and then save the new table map.
  5. Select Customers V3 (accounts) and then select Refresh tables to update the Dataverse metadata.
  6. Select Add mapping to add a new column mapping.
  7. Select None on the left, select the SALESSEGMENTID column, and then select OK.
  8. 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.
  9. Select Save to save the changes and then return to the Dual-write table map list by selecting Dual-write.
  10. Select Integration key.
  11. 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.
  12. From the Dual-write table map list, select Add table map.
  13. 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.
  14. Select Save.
  15. 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.
  16. Find and select Business segments (new_segments) in the dual-write table maps list and then select Run.
  17. Select the Initial sync option and then set the master for initial synch as finance and operations apps.
  18. Select Run.
  19. 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.
  20. Find and select Customer V3 (accounts) in the dual-write table maps list and then select Run.
  21. Select the Initial sync option and then set the master for initial synch as finance and operations apps.
  22. Select Run.
  23. Test your changes. Change a customer’s segment value and verify that the change syncs between the two applications.