Walkthrough: Extending retail data distribution infrastructure for customer preferences
Important
This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.
Applies To: Microsoft Dynamics AX 2012 R3
You include the new table fields in the configuration for data distribution to the channel database, the Commerce Runtime (CRT), and the channel. Then you update the schema, and generate classes by using the Microsoft Dynamics AX 2012 client. Next, you create a subjob for the new table to run under the Customer job, generate the classes needed, and run the initial data distribution.
Prerequisites Add the RetailCustPreferences table in the data distribution to the CRT for the Retail channel Create a subjob Include the schema of the new table in the Retail scheduler distribution |
Prerequisites
These walkthroughs illustrate adding a field to a retail channel that enables customers to opt in to receive special offers by email. In this scenario, the retailer wants to indicate whether customers wish to receive email about special offers, either in an online store or in a modern POS client. The walkthroughs should be completed in the following order:
Walkthrough: Adding a table for customer preferences to the AX 2012 database
Walkthrough: Extending the CRT to add customer preference data for Retail clients
Walkthrough: Extending retail data distribution infrastructure for customer preferences
Walkthrough: Adding customer preferences to the Retail online sample store (online store only)
Add the RetailCustPreferences table in the data distribution to the CRT for the Retail channel
The channel schema is the XML description of the data sent from AX 2012 to the channel database.
Open and click Retail > Setup > Retail scheduler > Retail channel schema.
Select the schema name that corresponds to the channel. For example, select AX 2012 R3 for Name and then click Location tables.
Click New and type the name of the new table, ax.RetailCustPreferences, in the Table name field.
Click Location Fields and enter the following field names.
Field name
Type
Length
ACCOUNTNUM
None
0
DATAREAID
None
0
EMAILOPTIN
None
0
RECID
None
0
Close the Location fields and Location tables forms.
Create a subjob
Next, you create a subjob of the CustTable job to move data in the new table to the channel database.
In Retail Headquarters, click Retail > Setup > Retail scheduler > Scheduler subjobs and then click New.
Enter RetailCustPreference in the Subjob number and Description fields.
Select AX 2012 R3 for Retail channel schema.
Select ax.RetailCustPreferences for Channel table name.
Select RetailCustPreferences for Microsoft Dynamics AX table name.
Click Transfer field list.
On the Field list form, click Functions and then click Match fields. The From field and To field columns are filled in.
Click Ok on the message dialog to close the Field list form.
Open the Retail channel schema form (click Retail > Setup > Retail scheduler > Retail channel schema).
Copy the XML in the Table distribution field into an editor such as Notepad++.
Tip
To copy all the XML, position your cursor and click before the first character (<). Using the scrollbar, scroll to the bottom of the file. Press Shift and then click after the last character (>). This ensures that all the XML is selected.
In the XML, search for the line <Table name = “RetailCustTable”>. There are two instances, at approximately line 29 and line 744.
Add the following code after the final line in both of the <Table name = “RetailCustTable”> code blocks. You add the code after the </Table> statement.
<Table name="RetailCustPreferences"> <LinkGroup> <Link type="FieldMatch" fieldName="accountNum" parentFieldName="AccountNum" /> </LinkGroup> </Table>
Copy the entire new XML file into the Table distribution window on the Retail channel schema form.
Close the Retail channel schema form.
Open the Scheduler job form (click Retail > Setup > Retail scheduler > Scheduler job).
Select 1010 to select the Customer job and then selet RetailCustPreferences for the subjob.
On the Retail channel Schema form, select AX 2012 R3 for the schema name and then click Generate classes.
This process may take some time.
Include the schema of the new table in the Retail scheduler distribution
In Retail Headquarters, click Retail > Setup > Retail scheduler > Distribution locations.
Select OOB Storefront and then run Functions > Read schema.
Accept the defaults and then click OK.