Walkthrough: Adding Properties to a Sales Order [AX 2012]

Updated: February 19, 2013

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2

You can customize sales order properties to send additional data from your online store to Microsoft Dynamics AX to meet the needs of your business processes.

The starter store has sales order properties that you can use to capture data during order transactions. You can extend the sales order properties to send additional data from your online store to Microsoft Dynamics AX during order transactions. For example, you could add an attribute called GiftWrap to indicate that an item should be wrapped.

To customize sales order properties:

  1. Create an attribute.

  2. Add the attribute to an attribute group.

  3. Assign the attribute group to your online store.

  4. Set the attribute on a sales order.

To create an attribute, you must define an attribute type and then assign the attribute type to your new attribute. In this example, you use an attribute type that is included in Microsoft Dynamics AX. For more information about attributes, see Set up attributes and attribute types.

To create an attribute

  1. In Microsoft Dynamics AX, click Product information management > Setup > Attributes > Attributes.

  2. Click New. Enter the following values:

    Property

    Value

    Name

    GiftWrap

    Friendly name

    Gift wrap

    Attribute type

    StringDomain

After you define your attribute, you can add it to an attribute group. For more information about attribute groups, see Set up retail attribute groups.

To create an attribute group and add your attribute

  1. Click Product information management > Setup > Attributes > Attribute groups.

  2. Click New. Enter the following values:

    Property

    Value

    Name

    SPSalesOrderGroup

    Friendly name

    Sales order attribute group

    Description

    Sales order attribute group

  3. In Attributes, click Add.

  4. Select GiftWrap, and then click Select.

  5. Click OK.

After you create your attribute group, assign it to your online store. For more information, see Set up an online store.

To assign an attribute group to your online store

  1. Click Retail > Common > Retail channels > Online stores. In the Online stores list, double-click your store.

  2. Click the Set up tab and then click Sales order attributes.

  3. In Channel attribute groups, click New.

  4. In Name, select SPSalesOrderGroup.

You can add the attribute to a sales order by adding business logic in the commerce runtime. Add the following code to add the attribute to the cart, save the cart, and then create a sales order from the cart.

            Var cart = orderManager.GetCart(cartId, accountNumber, false);
            cart.AttributeValues.Add(new AttributeTextValue { Name = "GiftWrap", TextValue = "Yes" });
            orderManager.SaveCart(cart);
            orderManager.CreateOrderFromCart(…);


After you create a sales order on the commerce runtime, you can view the new attribute in Microsoft Dynamics AX.

To view the attribute in Microsoft Dynamics AX

  1. In Microsoft Dynamics AX, click Retail > Periodic > Data distribution > Distribution schedule. Run the job P-0001_OC to run POS transactions in the online channel.

  2. Click Retail > Periodic > Synchronize online orders to create a sales order in Microsoft Dynamics AX.

  3. Click Accounts receivable > Common > Sales orders > All sales orders. Click the Retail tab, and then click Retail attributes. You should see the attribute you created.


Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).

Community Additions

ADD
Show: