+

Microsoft Dynamics 365 for Finance and Operations Connector 3.1 Additional Configuration Information - Mule 4

In Microsoft Dynamics 365 for Finance and Operations Connector 3.1.7 and later, you can use custom logic to configure properties of complex types when creating entities.

Configure Complex Types with Custom Logic

In Microsoft Dynamics 365 for Finance and Operations Connector 3.1.6 and earlier, suppose you use the following payload in the Create operation:

%dw 2.0
output application/java
---
{
    "Name": "GENERIC-CUSTOMER-NAME",
    "CustomerAccount": "CUSTOMER-ACCOUNT",
    "SalesCurrencyCode": "EUR",
    "CustomerGroupId": "GROUP-ID",
    "IsServiceDeliveryAddressBased": "No"
}

IsServiceDeliveryAddressBased is a property of the Microsoft.Dynamics.DataEntities.NoYes type, which is an enum type in the Microsoft data model. Using this payload in the Create operation throws an exception because the value for IsServiceDeliveryAddressBased is No, which is a string instead of an enum type.

In Microsoft Dynamics 365 for Finance and Operations Connector 3.1.7 and later, use the newly added custom logic to properly configure the property and avoid exceptions:

%dw 2.0
output application/java
---
{
    "Name": "GENERIC-CUSTOMER-NAME",
    "CustomerAccount": "CUSTOMER-ACCOUNT",
    "SalesCurrencyCode": "EUR",
    "CustomerGroupId": "GROUP-ID",
    "IsServiceDeliveryAddressBased": {
            "muleAdditions": {
                "kind": "enum",
                "type": "Microsoft.Dynamics.DataEntities.NoYes"
            },
            "value" : "No"
        }
}

The value for IsServiceDeliveryAddressBased must be an object type that contains the following fields:

  • muleAdditions

    • kind

      Key that indicates the kind of complex object. The only supported value is enum.

    • type

      Key that indicates the type in the Microsoft data model. Supported values are any enum type in the Microsoft data model.

      To find out the enum type:

      • In Microsoft Dynamics 365 for Finance and Operations Connector 3.1.7 and later, the improved metadata now shows the complete name of a data type.

        List of metadata that shows the complete naming of the data type
      • Execute a GET request on https://{tenant}.com/data/$metadata. The resulting XML file contains the entire data model.

  • value

    Key with the enum value as a string.

Next Step

After you complete configuring the connector, you can try the Examples.

Was this article helpful?

💙 Thanks for your feedback!

View on GitHub