.netxero-api

Xero API - Tracking Option doesn't add to Quote Item


I am creating a quote whilst trying to include a Tracking Option on a line Item. The payload looks fine but still doesn't add the Tracking Option. The quote returned to me has empty 'Tracking' and this reflects in the Xero UI.

Quote xeroQuote = new()
{
    QuoteID = quote.XeroId ?? null,
    Contact = new()
    {
        ContactID = customer.XeroId
    },
    Reference = quote.Reference,
    CurrencyCode = "GBP",
    Date = DateTime.Now,
    ExpiryDate = quote.ExpiryDate,
    LineItems = quote.Items.Select(x => new LineItem()
    {
        LineItemID = x.XeroLineItemId ?? null,
        ItemCode = x.ItemCode,
        Description = $"Some Description",
        UnitAmount = x.UnitAmount,
        Quantity = x.Quantity,
        LineAmount = x.LineAmount,
        Tracking = new()
        {
            new()
            {
                TrackingCategoryID = x.TrackingGroupOptionParentId,
                Name = x.TrackingGroupName,
                TrackingOptionID = x.TrackingGroupOptionId,
                Option = x.TrackingGroupOptionName
            }
        }
    }).ToList(),
    LineAmountTypes = QuoteLineAmountTypes.EXCLUSIVE
};

Payload:

{
  "Quotes": [
    {
      "CurrencyCode": "GBP",
      "LineAmountTypes": "EXCLUSIVE",
      "QuoteID": "Guid?",
      "Contact": {
        "ContactID": "Guid?"
      },
      "LineItems": [
        {
          "Description": "Some Description",
          "Quantity": 1,
          "UnitAmount": 15,
          "ItemCode": "GB3-White",
          "LineAmount": 15,
          "Tracking": [
            {
              "TrackingCategoryID": "Guid?",
              "TrackingOptionID": "Guid?",
              "Name": "Category Name",
              "Option": "Option Name"
            }
          ]
        }
      ],
      "Date": "2024-04-05T10:25:07.4838546Z"
    }
  ]
}

NOTE: Sensitive data has been replaced.

Whilst I am aware the docs say to just include TrackingOptionID, I have tried every possible configuration and nothing has worked so far.

To Reproduce Steps to reproduce the behavior:

  1. Create Quote using the AccountingApi.UpdateOrCreateQuotesAsync Class and method
  2. Observe payload
  3. Notice that the response has empty tracking in line item (Also see in Xero Dashboard/UI)

Expected behavior I expect to see my selected Tracking option for the line item.


Solution

  • Please can you raise a case with Xero Support and include details of your app's client id and the date and time of the most recent request (in UTC).

    You can raise a case here