Search code examples
dynamics-business-centralbusinesscentral

Business Central - POST sales invoice line using REST API - setting multiple dimension values


We use Business Central cloud API to POST sales invoices from other system

After creating the the sales invoice we create sales invoice lines to it by using {BC Endpoint}/SalesInvoiceLine API call but we are able to enter only two shortcut dimensions eg.

"Shortcut_Dimension_1_Code": "{value_fordim1}", "Shortcut_Dimension_2_Code": "{value_fordim2}

HOWEVER we need to set 4 dimensions for sales invoice line

We have tried to search MS API documentation for this situation but no luck

So far we haven't found a way to set all 4 dimension values to sales invoice line directly.

Current assumption is that we should somehow add new dimension set entry to BC (or search suitable combination from Dimension Set Entry table) and then somehow tie the sales invoice line to that Dimension Set Entry ID. However we do not know what API calls we could use for this.

Any guidance or help appriciated


Solution

  • We were able to solve this by using:

    POST {BC-endpoint}/SalesInvoiceLine call

    and just by entering the additional shortcut dimensions to the body

    {

    .......

    "ShortcutDimCode4": "{value_for_dim4}",
    "ShortcutDimCode5": "{value_for_dim5}"
    

    }