Show/Hide Toolbars

Additional Resources

This call will create items for all entries of the index data table that were not found in the previous call in Business Central. Each call can only create a single item. Consequently, this process needs to be repeated. If all items were found in the previous call this step will be skipped completely.

 

Method: POST

Endpoint: https://api.businesscentral.dynamics.com/v2.0/<environment name>/sandbox/api/v2.0/companies(<company id>)/items

 

Request Script:

 

This script will check all items in the index data table for entries without an Item Id. If one is found, it sets an itemNo, itemName, and itemPrice variable for the request. When this script is executed the next time the createLine counter variable will still be set so it continues exactly where it stopped.

 

Body Mapping:

 

JSON Name

JSON Value

Type

number

itemNo

Value

displayName

itemName

Value

unitPrice

itemPrice

Value

type

"Inventory"

Value

baseUnitOfMeasureCode

"PCS"

Value

 

 

Response Script:

 

This script takes the Item Id from the response and stores it in the index data. It utilizes the createLine variable which was set in the request script. As a final step, it sets RESTCall.NextRequest to CreateItem. This means that it repeats this call until the request script jumps to the next call.

Ā© 2024 Therefore Corporation, all rights reserved.