Skip to content

Dynamics 365 Business Central Sales Credit Memo XML

The XML format documented here is used for both the import and export of sales credit memos in Dynamics 365 Business Central.

We recommend that the ExternalId field be populated with the unique ID of the sales credit memos from the external system, Zynk uses this field to track sales credit memos already imported to prevent duplicates being created in Dynamics 365 Business Central.

Tasks

XML

Any fields not documented below are not supported with our imports / exports. Examples of where in the XML the fields should appear are shown in the samples below.

Sample Sales Credit Memo File:

<?xml version="1.0" encoding="utf-8"?>
<SalesCreditMemos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SalesCreditMemo>
    <Id>77434842-7e64-ea11-a813-000d3a86fa27</Id>
    <ExternalId>TEST-0001</ExternalId>
    <ODataETag>W/"JzQ0O1lWL3pXNlhteThLTm1kQndVQXc3SFp4c01OTmRiM3ZONkFXNzA4SXVOVXM9MTswMDsn"</ODataETag>
    <Number>1002</Number>
    <ExternalDocumentNumber>TEST-0001</ExternalDocumentNumber>
    <CustomerId>30219848-b45f-ea11-a812-000d3a86dae1</CustomerId>
    <ContactId />
    <CustomerNumber>C00020</CustomerNumber>
    <CustomerName>Zynk Software</CustomerName>
    <Customer>
      <Id>30219848-b45f-ea11-a812-000d3a86dae1</Id>
      <ExternalId>5230</ExternalId>
      <ODataETag>W/"JzQ0O3RCckJSU1NOdGw5Rk12cUVGQkVLaHFyNDZDMFgxMGcxT2htTHAwVmtOdWc9MTswMDsn"</ODataETag>
      <Number>C00020</Number>
      <DisplayName>Zynk Software</DisplayName>
      <Type>Person</Type>
      <AddressLine1>Office 16</AddressLine1>
      <AddressLine2>6 Charlotte Square</AddressLine2>
      <City>Newcastle</City>
      <State>Tyne &amp; Wear</State>
      <Country>GB</Country>
      <PostalCode>NE1 4XF</PostalCode>
      <PhoneNumber />
      <Email>[email protected]</Email>
      <Website>www.zynk.com</Website>
      <TaxLiable>false</TaxLiable>
      <TaxAreaId>0015deb9-611d-ea11-bb2d-000d3a4884fc</TaxAreaId>
      <TaxAreaDisplayName>Domestic customers and vendors</TaxAreaDisplayName>
      <TaxRegistrationNumber />
      <CurrencyId>00000000-0000-0000-0000-000000000000</CurrencyId>
      <CurrencyCode>GBP</CurrencyCode>
      <PaymentTermsId>9ab1e6b3-611d-ea11-bb2d-000d3a4884fc</PaymentTermsId>
      <ShipmentMethodId>c4b2e6b3-611d-ea11-bb2d-000d3a4884fc</ShipmentMethodId>
      <PaymentMethodId>a314deb9-611d-ea11-bb2d-000d3a4884fc</PaymentMethodId>
      <Blocked> </Blocked>
      <LastModifiedDateTime>2020-03-10T16:19:44.677Z</LastModifiedDateTime>
    </Customer>
    <BillToName>Zynk Software</BillToName>
    <BillToCustomerId>30219848-b45f-ea11-a812-000d3a86dae1</BillToCustomerId>
    <BillToCustomerNumber>C00020</BillToCustomerNumber>
    <BillToCustomer>
      <Id>30219848-b45f-ea11-a812-000d3a86dae1</Id>
      <ExternalId>5230</ExternalId>
      <ODataETag>W/"JzQ0O3RCckJSU1NOdGw5Rk12cUVGQkVLaHFyNDZDMFgxMGcxT2htTHAwVmtOdWc9MTswMDsn"</ODataETag>
      <Number>C00020</Number>
      <DisplayName>Zynk Software</DisplayName>
      <Type>Person</Type>
      <AddressLine1>Office 16</AddressLine1>
      <AddressLine2>6 Charlotte Square</AddressLine2>
      <City>Newcastle</City>
      <State>Tyne &amp; Wear</State>
      <Country>GB</Country>
      <PostalCode>NE1 4XF</PostalCode>
      <PhoneNumber />
      <Email>[email protected]</Email>
      <Website>www.zynk.com</Website>
      <TaxLiable>false</TaxLiable>
      <TaxAreaId>0015deb9-611d-ea11-bb2d-000d3a4884fc</TaxAreaId>
      <TaxAreaDisplayName>Domestic customers and vendors</TaxAreaDisplayName>
      <TaxRegistrationNumber />
      <CurrencyId>00000000-0000-0000-0000-000000000000</CurrencyId>
      <CurrencyCode>GBP</CurrencyCode>
      <PaymentTermsId>9ab1e6b3-611d-ea11-bb2d-000d3a4884fc</PaymentTermsId>
      <ShipmentMethodId>c4b2e6b3-611d-ea11-bb2d-000d3a4884fc</ShipmentMethodId>
      <PaymentMethodId>a314deb9-611d-ea11-bb2d-000d3a4884fc</PaymentMethodId>
      <Blocked> </Blocked>
      <LastModifiedDateTime>2020-03-10T16:19:44.677Z</LastModifiedDateTime>
    </BillToCustomer>
    <SellToAddressLine1>Office 16</SellToAddressLine1>
    <SellToAddressLine2>6 Charlotte Square</SellToAddressLine2>
    <SellToCity>Newcastle Upon Tyne</SellToCity>
    <SellToCountry>GB</SellToCountry>
    <SellToState>Tyne &amp; Wear</SellToState>
    <SellToPostCode>NE1 4XF</SellToPostCode>
    <BillToAddressLine1>Office 16</BillToAddressLine1>
    <BillToAddressLine2>6 Charlotte Square</BillToAddressLine2>
    <BillToCity>Newcastle Upon Tyne</BillToCity>
    <BillToCountry>GB</BillToCountry>
    <BillToState>Tyne &amp; Wear</BillToState>
    <BillToPostCode>NE1 4XF</BillToPostCode>
    <CurrencyId>00000000-0000-0000-0000-000000000000</CurrencyId>
    <CurrencyCode>GBP</CurrencyCode>
    <PaymentTermsId>9ab1e6b3-611d-ea11-bb2d-000d3a4884fc</PaymentTermsId>
    <ShipmentMethodId>00000000-0000-0000-0000-000000000000</ShipmentMethodId>
    <Salesperson>PS</Salesperson>
    <DiscountAmount>0</DiscountAmount>
    <TotalAmountExcludingTax>89</TotalAmountExcludingTax>
    <TotalTaxAmount>17.8</TotalTaxAmount>
    <TotalAmountIncludingTax>106.8</TotalAmountIncludingTax>
    <Status>Draft</Status>
    <LastModifiedDateTime>2020-03-18T16:24:05.093Z</LastModifiedDateTime>
    <PhoneNumber />
    <Email>[email protected]</Email>
    <PostingDate>2020-03-12T00:00:00</PostingDate>
    <PaymentTerm>
      <Id>9ab1e6b3-611d-ea11-bb2d-000d3a4884fc</Id>
      <ODataETag>W/"JzQ0O3U3bDZJYzh5UFdXa2xMbWZoV2dacis5RXJvSHZEUktpald0OElZd0ZHSWc9MTswMDsn"</ODataETag>
      <Code>14 DAYS</Code>
      <DisplayName>Net 14 days</DisplayName>
      <DueDateCalculation>14D</DueDateCalculation>
      <DiscountDateCalculation />
      <DiscountPercent>0</DiscountPercent>
      <CalculateDiscountOnCreditMemos>false</CalculateDiscountOnCreditMemos>
      <LastModifiedDateTime>2019-12-13T04:34:12.093Z</LastModifiedDateTime>
    </PaymentTerm>
    <CreditMemoDate>2020-02-13T00:00:00</CreditMemoDate>
    <DueDate>2020-02-13T00:00:00</DueDate>
    <PricesIncludeTax>true</PricesIncludeTax>
    <DiscountAppliedBeforeTax>false</DiscountAppliedBeforeTax>
    <InvoiceId>00000000-0000-0000-0000-000000000000</InvoiceId>
    <InvoiceNumber>102224</InvoiceNumber>
    <SalesCreditMemoLines>
      <SalesCreditMemoLine>
        <Id>77434842-7e64-ea11-a813-000d3a86fa27-10000</Id>
        <ExternalId>TEST-0001-1</ExternalId>
        <ODataETag>W/"JzQ0O1h3OXJYdHVMQVgzSm9PVHYxMTdtSG9rY2Q0Vks4dU4vZXBJUDI1RkJ6U1U9MTswMDsn"</ODataETag>
        <DocumentId>77434842-7e64-ea11-a813-000d3a86fa27</DocumentId>
        <Sequence>10000</Sequence>
        <ItemId>b7b3e6b3-611d-ea11-bb2d-000d3a4884fc</ItemId>
        <Item>
          <Id>b7b3e6b3-611d-ea11-bb2d-000d3a4884fc</Id>
          <Number>1928-S</Number>
          <DisplayName>AMSTERDAM Lamp</DisplayName>
          <Type>Inventory</Type>
          <ItemCategoryId>2b18deb9-611d-ea11-bb2d-000d3a4884fc</ItemCategoryId>
          <ItemCategoryCode>MISC</ItemCategoryCode>
          <Blocked>false</Blocked>
          <BaseUnitOfMeasureId>2fb4e6b3-611d-ea11-bb2d-000d3a4884fc</BaseUnitOfMeasureId>
          <BaseUnitOfMeasureCode>PCS</BaseUnitOfMeasureCode>
          <Gtin />
          <Inventory>8</Inventory>
          <UnitPrice>35.6</UnitPrice>
          <PriceIncludesTax>false</PriceIncludesTax>
          <UnitCost>27.8</UnitCost>
          <TaxGroupId>00000000-0000-0000-0000-000000000000</TaxGroupId>
          <TaxGroupCode />
        </Item>
        <AccountId>00000000-0000-0000-0000-000000000000</AccountId>
        <Account>
          <Number>10100</Number>
        </Account>
        <LineType>Item</LineType>
        <LineObjectNumber>1928-S</LineObjectNumber>
        <Description>AMSTERDAM Lamp</Description>
        <UnitOfMeasureId>2fb4e6b3-611d-ea11-bb2d-000d3a4884fc</UnitOfMeasureId>
        <UnitOfMeasureCode>PCS</UnitOfMeasureCode>
        <Quantity>3</Quantity>
        <UnitPrice>35.6</UnitPrice>
        <DiscountAmount>0</DiscountAmount>
        <DiscountPercent>0</DiscountPercent>
        <DiscountAppliedBeforeTax>false</DiscountAppliedBeforeTax>
        <AmountExcludingTax>89.00</AmountExcludingTax>
        <TaxCode>STANDARD</TaxCode>
        <TaxPercent>20</TaxPercent>
        <TotalTaxAmount>17.80</TotalTaxAmount>
        <AmountIncludingTax>106.8</AmountIncludingTax>
        <NetAmount>89</NetAmount>
        <NetTaxAmount>17.8</NetTaxAmount>
        <NetAmountIncludingTax>106.8</NetAmountIncludingTax>
        <InvoiceDiscountAllocation>0</InvoiceDiscountAllocation>
        <ShipmentDate>2020-03-12T00:00:00</ShipmentDate>
      </SalesCreditMemoLine>
    </SalesCreditMemoLines>
  </SalesCreditMemo>
</SalesCreditMemos>

In each of the following sections most of the XML has been omitted to make the samples easier to read. The whole structure of the SalesCreditMemos schema is used below as a reference of where fields should be in the object model.

General

The following information can be found within the 'General' section.

Dynamics Field XML Field  Type  Input  Notes
- Id Guid Optional Used for matching existing sales credit memos
- ExternalId string Optional Stored in Zynk's internal DB and used for matching existing sales credit memos
No. Number string Optional Used for matching existing sales credit memos. The next number will be used when creating a new sales credit memo if not specified
External Document No. ExternalDocumentNumber string Optional Used for matching existing sales credit memos
Customer No. CustomerId Guid Optional
Customer No. CustomerNumber string Optional Performs a lookup for the customer ID based on the number
Customer No. Customer Customer Optional Used for looking up and auto creating customers
Customer No. ContactId string Optional Used for looking up the customer
Customer Name CustomerName string Read-only
Sell-To > Address SellToAddressLine1 string Optional
Sell-To > Address SellToAddressLine2 string Optional
Sell-To > City SellToCity string Optional
Sell-To > County SellToState string Optional
Sell-To > Country/Region Code SellToCountry string Optional
Sell-To > Postcode SellToPostCode string Optional
Phone No. PhoneNumber string Optional
Email Email string Optional
Posting Date PostingDate DateTime Optional
Document Date CreditMemoDate DateTime Optional
Due Date DueDate DateTime Optional
Salesperson Code Salesperson string Optional
Status Status string Read-only Can be: Draft, In Review, Open, Paid, Canceled, or Corrective
<?xml version="1.0" encoding="utf-8"?>
<SalesCreditMemos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SalesCreditMemo>
    <Id>77434842-7e64-ea11-a813-000d3a86fa27</Id>
    <ExternalId>TEST-0001</ExternalId>
    <Number>1002</Number>
    <ExternalDocumentNumber>TEST-0001</ExternalDocumentNumber>
    <CustomerId>30219848-b45f-ea11-a812-000d3a86dae1</CustomerId>
    <CustomerNumber>C00020</CustomerNumber>
    <Customer>
      <!-- See Customer XML for more details -->
    </Customer>
    <ContactId />
    <CustomerName>Zynk Software</CustomerName>
    <SellToAddressLine1>Office 16</SellToAddressLine1>
    <SellToAddressLine2>6 Charlotte Square</SellToAddressLine2>
    <SellToCity>Newcastle Upon Tyne</SellToCity>
    <SellToState>Tyne &amp; Wear</SellToState>
    <SellToCountry>GB</SellToCountry>
    <SellToPostCode>NE1 4XF</SellToPostCode>
    <PhoneNumber>0191 820 1484</PhoneNumber>
    <Email>[email protected]</Email>
    <PostingDate>2020-03-12T00:00:00</PostingDate>
    <CreditMemoDate>2020-02-13T00:00:00</CreditMemoDate>
    <DueDate>2020-02-13T00:00:00</DueDate>
    <Salesperson>PS</Salesperson>
    <Status>Draft</Status>
  </SalesCreditMemo>
</SalesCreditMemos>

Lines

The following information can be found within the 'Lines' section.

Dynamics Field XML Field  Type  Input  Notes
- Id string Optional Used for matching existing lines
- ExternalId string Optional Stored in Zynk's internal DB and used for matching existing lines
- Sequence string Optional Used for matching existing lines. The next number will be used when creating a new line if not specified
No. ItemId Guid Optional Used for matching existing lines.
No. Item Item Optional Used for looking up and auto creating items
- AccountId Guid Optional The line type will be automatically set to 'Account' if specified
- Account/Number Guid Optional Performs a lookup for the account ID based on number
Type LineType string Optional Can be: Comment, Account, Item, Resource, Fixed Asset, Charge
No. LineObjectNumber string Optional Performs a lookup for the item or account based on number
Description Description string Optional
Quantity Quantity decimal Required
Unit of Measure Code UnitOfMeasureId Guid Optional
Unit of Measure Code UnitOfMeasureCode string Optional Performs a lookup for the unit of measure ID based on code
Unit Price UnitPrice decimal Required
Line Discount % DiscountPercent decimal Optional
Line Discount % DiscountAmount decimal Optional
- DiscountAppliedBeforeTax bool Read-only
- ShipmentDate DateTime Optional
- AmountExcludingTax decimal Read-only
- TaxCode string Optional
- TaxPercent decimal Read-only
- TotalTaxAmount decimal Read-only
- AmountIncludingTax decimal Read-only
- NetAmount decimal Read-only
- NetTaxAmount decimal Read-only
- NetAmountIncludingTax decimal Read-only
- InvoiceDiscountAllocation decimal Read-only
Inv. Discount Amount Incl. VAT DiscountAmount decimal Optional
Total Excl. VAT TotalAmountExcludingTax decimal Read-only
Total VAT TotalTaxAmount decimal Read-only
Total Incl. VAT TotalAmountIncludingTax decimal Read-only
- DiscountAppliedBeforeTax bool Read-only
<?xml version="1.0" encoding="utf-8"?>
<SalesCreditMemos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SalesCreditMemo>
    <SalesCreditMemoLines>
      <SalesCreditMemoLine>
        <Id>77434842-7e64-ea11-a813-000d3a86fa27-10000</Id>
        <ExternalId>TEST-0001-1</ExternalId>
        <Sequence>10000</Sequence>
        <ItemId>b7b3e6b3-611d-ea11-bb2d-000d3a4884fc</ItemId>
        <Item>
          <!-- See Item XML for more details -->
        </Item>
        <AccountId>f9b2e6b3-611d-ea11-bb2d-000d3a4884fc</AccountId>
        <Account>
          <Number>10100</Number>
        </Account>
        <LineType>Item</LineType>
        <LineObjectNumber>1928-S</LineObjectNumber>
        <Description>AMSTERDAM Lamp</Description>
        <Quantity>3</Quantity>
        <UnitOfMeasureId>2fb4e6b3-611d-ea11-bb2d-000d3a4884fc</UnitOfMeasureId>
        <UnitOfMeasureCode>PCS</UnitOfMeasureCode>
        <UnitPrice>35.6</UnitPrice>
        <DiscountAmount>0</DiscountAmount>
        <DiscountPercent>0</DiscountPercent>
        <DiscountAppliedBeforeTax>false</DiscountAppliedBeforeTax>
        <ShipmentDate>2020-03-12T00:00:00</ShipmentDate>
        <AmountExcludingTax>89.00</AmountExcludingTax>
        <TaxCode>STANDARD</TaxCode>
        <TaxPercent>20</TaxPercent>
        <TotalTaxAmount>17.80</TotalTaxAmount>
        <AmountIncludingTax>106.8</AmountIncludingTax>
        <NetAmount>89</NetAmount>
        <NetTaxAmount>17.8</NetTaxAmount>
        <NetAmountIncludingTax>106.8</NetAmountIncludingTax>
        <InvoiceDiscountAllocation>0</InvoiceDiscountAllocation>
      </SalesCreditMemoLine>
    </SalesCreditMemoLines>
    <DiscountAmount>0</DiscountAmount>
    <TotalAmountExcludingTax>89</TotalAmountExcludingTax>
    <TotalTaxAmount>17.8</TotalTaxAmount>
    <TotalAmountIncludingTax>106.8</TotalAmountIncludingTax>
    <DiscountAppliedBeforeTax>false</DiscountAppliedBeforeTax>
  </SalesCreditMemo>
</SalesCreditMemos>

Credit Memo Details

The following information can be found within the 'Credit Memo Details' section.

Dynamics Field XML Field  Type  Input  Notes
Currency Code CurrencyId Guid Optional
Currency Code CurrencyCode string Optional Use the 3 letter ISO code
Prices Including VAT PricesIncludeTax bool Optional
Payment Terms Code PaymentTermsId Guid Optional
Payment Terms Code PaymentTerm/Code string Optional Performs a lookup for the payment terms based on code
<?xml version="1.0" encoding="utf-8"?>
<SalesCreditMemos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SalesCreditMemo>
    <CurrencyId>00000000-0000-0000-0000-000000000000</CurrencyId>
    <CurrencyCode>GBP</CurrencyCode>
    <PricesIncludeTax>true</PricesIncludeTax>
    <PaymentTermsId>9ab1e6b3-611d-ea11-bb2d-000d3a4884fc</PaymentTermsId>
    <PaymentTerm>
      <Code>14 DAYS</Code>
    </PaymentTerm>
  </SalesCreditMemo>
</SalesCreditMemos>

Billing

The following information can be found within the 'Billing' section.

Dynamics Field XML Field  Type  Input  Notes
Bill-to > Name BillToCustomerId Guid Optional
Bill-to > Name BillToCustomerNumber string Optional Performs a lookup for the customer ID based on the number
Bill-to > Name BillToCustomer Customer Optional Used for looking up and auto creating customers
Bill-to > Name BillToName string Read-only
Bill-to > Address BillToAddressLine1 string Optional
Bill-to > Address BillToAddressLine2 string Optional
Bill-to > City BillToCity string Optional
Bill-to > County BillToState string Optional
Bill-to > Country/Region Code BillToCountry string Optional
Bill-to > Postcode BillToPostCode string Optional
<?xml version="1.0" encoding="utf-8"?>
<SalesCreditMemos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SalesCreditMemo>
    <BillToCustomerId>30219848-b45f-ea11-a812-000d3a86dae1</BillToCustomerId>
    <BillToCustomerNumber>C00020</BillToCustomerNumber>
    <BillToCustomer>
      <!-- See Customer XML for more details -->
    </BillToCustomer>
    <BillToName>Zynk Software</BillToName>
    <BillToAddressLine1>Office 16</BillToAddressLine1>
    <BillToAddressLine2>6 Charlotte Square</BillToAddressLine2>
    <BillToCity>Newcastle Upon Tyne</BillToCity>
    <BillToState>Tyne &amp; Wear</BillToState>
    <BillToCountry>GB</BillToCountry>
    <BillToPostCode>NE1 4XF</BillToPostCode>
  </SalesCreditMemo>
</SalesCreditMemos>

Miscellaneous

The following information is not visible within Dynamics 365 Business Central.

Dynamics Field XML Field  Type  Input  Notes
- ODataETag string Optional Specify the last value to prevent updates if the record has since been modified
- LastModifiedDateTime DateTime Read-only
- InvoiceId Guid Optional
- InvoiceNumber DateTime Optional Performs a lookup for the invoice ID based on the number
<?xml version="1.0" encoding="utf-8"?>
<SalesCreditMemos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SalesCreditMemo>
    <ODataETag>W/"JzQ0O1lWL3pXNlhteThLTm1kQndVQXc3SFp4c01OTmRiM3ZONkFXNzA4SXVOVXM9MTswMDsn"</ODataETag>
    <LastModifiedDateTime>2020-03-18T16:24:05.093Z</LastModifiedDateTime>
    <InvoiceId>00000000-0000-0000-0000-000000000000</InvoiceId>
    <InvoiceNumber>102224</InvoiceNumber>
  </SalesCreditMemo>
</SalesCreditMemos>