Overview
The list page that contains the Receipt Agreement Lines in Wisefish.
It contains the lines of both Blanket and Receipt purchase agreements. The same lines are also available as the child purchaseAgreementLines of the purchaseAgreements, openPurchaseAgreements and closedPurchaseAgreements endpoints (with $expand=purchaseAgreementLines).
|
Endpoint name |
|
|
Source table |
|
|
Fixed view |
Lines of Blanket and Receipt agreements ( |
|
Requests allowed |
GET, POST, PATCH, DELETE |
|
Primary key |
|
|
Record ID |
|
|
Procedures |
|
|
Child of |
|
Data
Field List
|
Property |
Type |
Format |
Description |
|
|
|---|---|---|---|---|---|
|
1 |
|
string |
uuid |
The unique id of the record. |
Record ID non-editable |
|
2 |
|
string |
enum |
Same document type as for the header, i.e. Receipt or Blanket. If not given when adding a new line, the default is Receipt Options: Blanket, Receipt, Quote. Only Blanket and Receipt lines are shown by this endpoint. |
primary key |
|
3 |
|
string |
max 20 |
The number of the agreement. |
primary key |
|
4 |
|
integer |
|
Line number is usually set automatically. If not given (0) when a line is added, it is set to the last line no. of the agreement + 100, or 100 for the first line. |
primary key |
|
5 |
|
string |
enum |
This is usually Item, but it is possible to create lines with blank if they are only text lines. Options: (blank), Item. If not given when adding a new line, the default is Item. |
optional |
|
6 |
|
string |
max 20 |
The item number. |
mandatory |
|
7 |
|
string |
max 100 |
Description of the item, or the text, if it is a text line. |
optional |
|
8 |
|
number |
decimal |
The number of trade items. This one is marked as mandatory because that is the recommended usage. Possib |
recommended |
|
9 |
|
string |
max 10 |
The unit that belongs to |
optional |
|
10 |
|
number |
decimal |
Quantity, will be calculated automatically if |
optional |
|
11 |
|
string |
max 10 |
This is the unit of measure that belongs to the |
non-editable |
|
12 |
|
number |
decimal |
Quantity in the base unit of the item. |
optional |
|
13 |
|
string |
max 10 |
The base unit of the item. |
non-editable |
|
14 |
|
number |
decimal |
Direct unit cost. |
optional |
|
15 |
|
number |
decimal |
Unit cost. |
non-editable |
|
16 |
|
number |
decimal |
Line Amount, is the amount before discount is subtracted. |
optional |
|
17 |
|
number |
decimal |
This is the discount percentage (%). |
optional |
|
18 |
|
number |
decimal |
Line Discount is the total discount amount. |
optional |
|
19 |
|
number |
decimal |
The amount when discount has been subtracted. |
non-editable |
|
20 |
|
number |
decimal |
The VAT percentage (%). |
non-editable |
|
21 |
|
number |
decimal |
Amount + VAT amount. |
non-editable |
|
22 |
|
string |
date |
The purchase will not post if it does not have a production date. It is also required when a line is added: a POST without |
mandatory |
|
23 |
|
string |
max 20 |
Original producer. |
optional |
|
24 |
Added |
string |
max 20 |
If the lot for this line has already been decided, it shall be put into this field. The value must already exist in BC, in the Lot list. To create it the If left empty, the origin lot will be created at the time of posting. A new lot can also be created and assigned to the line with the procedure |
optional |
|
25 |
|
number |
decimal |
Net Weight of these trade items in base weight unit. |
non-editable |
|
26 |
|
number |
decimal |
Gross Weight of these trade items in base weight unit. |
non-editable |
|
27 |
|
string |
date |
Landing date |
optional |
|
28 |
|
string |
max 10 |
The code of the landing harbour |
optional |
|
29 |
Added |
string |
max 80 |
Can be used with POST and PATCH to create one comment line for this agreement line. When read (GET) it is always empty. |
optional |
|
30 |
|
integer |
|
System row version. Increments every time the record is modified. |
non-editable |
|
31 |
|
string |
date-time |
Time stamp of last modification. |
non-editable |
|
32 |
|
string |
max 50 |
The user who last modified the record |
non-editable |
Object Example
In the following example the system is in KG, but this item is sold in LBS. Therefore:
-
User has typed in the number of trade items: 100 LB which can be seen in fields
noOfTradeItemsandtradeItemUnitOfMeasure -
Fields
quantityandunitOfMeasureshow that this is roughly 45 KG. When this line is posted, this will go into the Item Ledger as “quantity”. -
Fields
quantityBaseandbaseUnitOfMeasureshow that this will be posted in the Item Ledger Entry as “base quantity” 100 LB. -
Fields
netWeightandgrossWeightwill show how much weight this is in the general weight unit of the system which is in this case KG.
{
"systemId": "b2fece31-c408-f111-b02e-e6f9cc72e785",
"documentType": "Receipt",
"documentNo": "PR-048",
"lineNo": 10000,
"type": "Item",
"itemNo": "70080",
"description": "Some item in LBS",
"noOfTradeItems": 100,
"tradeItemUnitOfMeasure": "LB",
"quantity": 45.35924,
"unitOfMeasure": "KG",
"quantityBase": 100.00000,
"baseUnitOfMeasure": "LB",
"directUnitCost": 0,
"unitCost": 0,
"lineAmount": 0,
"lineDiscount": 0,
"lineDiscountAmount": 0,
"amount": 0,
"vat": 25,
"amountIncludingVAT": 0,
"productionDate": "0001-01-01",
"originalProducer": "",
"lot": "",
"netWeight": 45.359,
"grossWeight": 45.813,
"landingDate": "0001-01-01",
"portOfLanding": "",
"addComment": "",
"systemRowVersion": 2587311,
"lastModified": "2026-02-13T10:18:43.637Z",
"modifiedByUser": ""
}
Procedures
Procedures are called on a specific agreement line: POST purchaseAgreementLines(<systemId>)/Microsoft.NAV.<procedureName> with a JSON body of parameters. Each procedure returns a text message in the value property of the response. On failure it returns an error with a readable message.
|
Procedure |
Parameters |
Description |
Details |
|---|---|---|---|
|
|
|
Create a new origin lot and assign it to the line ( |
|
|
|
|
Add a comment line to the agreement line. |
|
|
|
|
Change the text of an existing comment line of the agreement line. |
Lots
Assign Lot
To create a new origin lot and assign it to the agreement line, use procedure assignLot. This is an alternative to creating the lot first with the lots endpoint and then setting lot on the line.
POST
.../purchaseAgreementLines([systemId])/Microsoft.NAV.assignLot
Body:
{
"lotCode": [code of the new lot, or empty],
"lotDescription": [description of the new lot]
}
|
Parameters |
Type |
Max Len |
Description |
|
|---|---|---|---|---|
|
|
string |
20 |
The code of the new lot. If empty, the code is assigned automatically from the number series for lots. |
optional |
|
|
string |
50 |
The description of the new lot. If empty, the description is Origin lot. |
optional |
If successful, a new lot is created and assigned to the line (lot), and the response is: Lot <Lot Code> assigned to the purchase line.
Possible errors:
-
The agreement line does not exist (standard Business Central error, record not found).
-
A lot with the code
lotCodealready exists (standard Business Central error, the record already exists). -
No lot code can be assigned from the number series when
lotCodeis empty (standard Business Central number series error). -
The line has no stock center (standard Business Central TestField error: Stock Center Code must have a value).
-
Any validation error when the stock center is set on the lot, or when the lot is set on the line (
lot). -
A parameter is longer than its maximum length (standard Business Central error).
Behaviour notes:
-
The new lot is an origin lot: production type (blank), default hold status (blank), creation date today. Its stock center is the stock center of the line, and its ending date is the expected receipt date of the line.
-
The lot is created before the line is checked. If any step fails, nothing is saved: the lot is not created and the line is not changed.
-
The status of the agreement is not checked.
-
A lot that already exists cannot be assigned with this procedure. To use an existing lot, set
lotwith PATCH.
Line Comments
For each Agreement Line there is a table for adding comment. Looks like this in BC:
Instead of handling this with APIs on the comment table itself, there are shortcut methods on this API:
-
addCommentLine -
updateCommentLine
Add Comment Line
To add a comment line to the agreement line, use procedure addCommentLine:
POST
.../purchaseAgreementLines([systemId])/Microsoft.NAV.addCommentLine
Body:
{
"comment": [the comment text]
}
|
Parameters |
Type |
Max Len |
Description |
|
|---|---|---|---|---|
|
|
string |
80 |
The comment text to add on the line |
mandatory |
If successful, a comment line is added and the response is: Comment line <Line No.> added for the purchase line. <Line No.> is the line no. of the new comment line.
Possible errors:
-
The agreement line does not exist (standard Business Central error, record not found).
-
commentis longer than 80 characters (standard Business Central error).
Behaviour notes:
-
The comment lines of an agreement line are numbered 1, 2, 3 … The new comment line gets the next number after the last one.
-
The comment line gets today's date, and both Print on Order and Print on Invoice are set.
-
The comment text is not validated: an empty
commentadds an empty comment line. -
A comment line can also be added together with POST or PATCH on the line, with the property
addComment.
Update Comment Line
To change the text of an existing comment line, use procedure updateCommentLine:
POST
.../purchaseAgreementLines([systemId])/Microsoft.NAV.updateCommentLine
Body:
{
"commentLineNo": [line no. of the comment line],
"comment": [the new comment text]
}
|
Parameters |
Type |
Max Len |
Description |
|
|---|---|---|---|---|
|
|
integer |
|
The line no. of the comment to update. The comments made with the API are numbered with 1, 2, 3 … |
mandatory |
|
|
string |
80 |
The comment text to update into that comment line |
mandatory |
If successful, the comment text is changed and the response is: Comment line <commentLineNo> updated for the purchase line.
-
If the agreement line has no comment line with this number, this is not an error. Nothing is changed, the call succeeds and the response is:
Comment line <commentLineNo> not found for the purchase line.
Possible errors:
-
The agreement line does not exist (standard Business Central error, record not found).
-
commentis longer than 80 characters (standard Business Central error).
Behaviour notes:
-
Only the comment text is changed; the date of the comment line is not changed.
Examples
Read agreement lines
Read the lines of one agreement
Reads all lines of purchase agreement PR-048.
GET .../purchaseAgreementLines?$filter=documentNo eq 'PR-048'
Read selected properties of a line
Reads only the item and quantities of one line, by its Record ID (systemId).
Request:
GET .../purchaseAgreementLines(b2fece31-c408-f111-b02e-e6f9cc72e785)?$select=documentNo,lineNo,itemNo,noOfTradeItems,tradeItemUnitOfMeasure,quantity,unitOfMeasure
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/purchaseAgreementLines(documentNo,lineNo,itemNo,noOfTradeItems,tradeItemUnitOfMeasure,quantity,unitOfMeasure)/$entity",
"@odata.etag": "W/\"JzIwOzEyMzQ1Njc4OTAxMjM0NTY3ODkwMTE7MDA7Jw==\"",
"documentNo": "PR-048",
"lineNo": 10000,
"itemNo": "70080",
"noOfTradeItems": 100,
"tradeItemUnitOfMeasure": "LB",
"quantity": 45.35924,
"unitOfMeasure": "KG"
}
Read an agreement with its lines
Reads purchase agreement PR-048 with its lines, through the parent endpoint.
GET .../purchaseAgreements?$filter=documentNo eq 'PR-048'&$expand=purchaseAgreementLines
Add, change and delete lines
Add a line to an agreement
Adds a line for 100 LB of item 70080 to agreement PR-048, with a comment line. lineNo is not given, so it is set automatically (last line no. + 100).
Request:
POST .../purchaseAgreementLines
Body:
{
"documentType": "Receipt",
"documentNo": "PR-048",
"itemNo": "70080",
"noOfTradeItems": 100,
"tradeItemUnitOfMeasure": "LB",
"productionDate": "2026-02-12",
"addComment": "This will be delivered on pallets"
}
Response (shortened):
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/purchaseAgreementLines/$entity",
"@odata.etag": "W/\"JzIwOzE4MjczNjQ1NTQ2MzcyODE5MjAxOzAwOyc=\"",
"systemId": "c41a7d52-c408-f111-b02e-e6f9cc72e785",
"documentType": "Receipt",
"documentNo": "PR-048",
"lineNo": 10100,
"type": "Item",
"itemNo": "70080",
"description": "Some item in LBS",
"noOfTradeItems": 100,
"tradeItemUnitOfMeasure": "LB",
"quantity": 45.35924,
"unitOfMeasure": "KG",
"productionDate": "2026-02-12",
"addComment": "",
"systemRowVersion": 2587402,
"lastModified": "2026-02-13T11:02:15.210Z"
}
Change a line
Changes the number of trade items on a line. A PATCH request needs the If-Match header with the @odata.etag of the record (or *).
Request:
PATCH .../purchaseAgreementLines(b2fece31-c408-f111-b02e-e6f9cc72e785)
If-Match: *
Body:
{
"noOfTradeItems": 120
}
Response (shortened):
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/purchaseAgreementLines/$entity",
"@odata.etag": "W/\"JzIwOzk4NzY1NDMyMTAxMjM0NTY3ODkwOzAwOyc=\"",
"systemId": "b2fece31-c408-f111-b02e-e6f9cc72e785",
"documentType": "Receipt",
"documentNo": "PR-048",
"lineNo": 10000,
"itemNo": "70080",
"noOfTradeItems": 120,
"tradeItemUnitOfMeasure": "LB",
"quantity": 54.43109,
"unitOfMeasure": "KG",
"systemRowVersion": 2587455,
"lastModified": "2026-02-13T11:20:41.004Z"
}
Delete a line
Deletes one agreement line. On success the response is empty (HTTP status 204 No Content).
DELETE .../purchaseAgreementLines(b2fece31-c408-f111-b02e-e6f9cc72e785)
Assign a lot
Assign a new lot with a given code
Creates lot LOT-PR048-1 and assigns it to the line with assignLot.
Request:
POST .../purchaseAgreementLines(b2fece31-c408-f111-b02e-e6f9cc72e785)/Microsoft.NAV.assignLot
Body:
{
"lotCode": "LOT-PR048-1",
"lotDescription": "Cod, landing 12 February"
}
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Lot LOT-PR048-1 assigned to the purchase line."
}
Assign a lot numbered from the number series
Creates a lot with a code from the number series (lotCode empty) and assigns it to the line.
Request:
POST .../purchaseAgreementLines(b2fece31-c408-f111-b02e-e6f9cc72e785)/Microsoft.NAV.assignLot
Body:
{
"lotCode": "",
"lotDescription": ""
}
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Lot LOT000123 assigned to the purchase line."
}
Comment lines
Add a comment to a line
Adds the comment “This will be delivered on pallets” to an agreement line with addCommentLine.
POST
.../purchaseAgreementLines([systemId])/Microsoft.NAV.addCommentLine
Body:
{
"comment": "This will be delivered on pallets"
}
Response:
"value": "Comment line 3 added for the purchase line."
Update a comment on a line
Changes the text of comment line 3 with updateCommentLine.
POST
.../purchaseAgreementLines([systemId])/Microsoft.NAV.updateCommentLine
Body:
{
"commentLineNo": 3,
"comment": "This will be delivered on BARCODED pallets"
}
Response:
"value": "Comment line 3 updated for the purchase line."
Update a comment line that does not exist
The line has no comment line 7. This is not an error: nothing is changed and the response says so.
Request:
POST .../purchaseAgreementLines(b2fece31-c408-f111-b02e-e6f9cc72e785)/Microsoft.NAV.updateCommentLine
Body:
{
"commentLineNo": 7,
"comment": "This will be delivered on BARCODED pallets"
}
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Comment line 7 not found for the purchase line."
}