Breadcrumbs

API - Sales Agreement Lines


Overview

The list page that contains the lines of a Sales Agreement, i.e. the items, quantity, units, unit prices and total amount.

This endpoint is used for the child entries on salesAgreements, openSalesAgreements and closedSalesAgreements.

Endpoint name

salesAgreementLines

Source table

WiFi Sales Agreement Line

Fixed view

Shows only entries from the table with Status = Open or Released.

Requests allowed

GET, POST, PATCH, DELETE

Primary key

Document Type, Document No., Line No.

Record ID

systemId

Procedures

For easier usage, there are procedures to update the main figures of the line:

updateQuantity, updateUnitPrice, updateQuantityAndUnitPrice

Methods to reserve and release a pallet:

reservePallet, releasePallet


Data

Field List

Property

Type

Max Len

Description


1

systemId

string uuid


Since the primary key is combined of multiple fields, this must be used as the record Id of the API.

record id

2

documentType

string


Options are: Blanket, Delivery

Delivery is the default value when the property is skipped.

See Wisefish documentation to understand the difference.

primary key

3

documentNo

string

20

The number of the sales agreement this line belongs to.

primary key

4

lineNo

integer


The key of this line within the document.

primary key

5

type

string


Options are Item (the default). If this is blank, this line is just a text line put on the document for information.


6

itemNo

string

20

The item number

Mandatory

7

description

string

100

Description of the item


8

locationCode

string

10

These properties tell which inventory should be sold. Usually set on the header.

(Is it okay to use different locations for the lines on same document?)


9

stockCenterCode

string

20

These properties tell which inventory should be sold.

Usually set on the header.

(Is it okay to use different locations for the lines on same document?)


10

lotFilter

string

20

These properties tell which inventory should be sold.


11

lotFilterOriginal

string

20

These properties tell which inventory should be sold.


12

noOfTradeItems

integer


Number of trade items. If this field is used, then quantity is calculated automatically.


13

tradeItemUnit

string

10

Must be given when noOfTradeItems is used.


14

quantity

decimal


Quantity to be sold. It is possible to sell in a unit that is not the base unit of the item.

Mandatory

15

unitOfMeasureCode

string

10

The unit that belongs to field quantity

Mandatory

16

quantityBase

decimal


The quantity to be sold in the base unit.


17

noOfPallets

integer


The system estimates how many pallets are needed, according to a normal quantity on pallet. This does not set any restrictions on how many pallets can be reserved.


18

unitPrice

decimal


Pricing and total amounts


19

purchPriceToVendor

decimal


Pricing and total amounts


20

lineAmount

decimal


Pricing and total amounts


21

lineDiscount

decimal


Pricing and total amounts


22

lineDiscountAmount

decimal


Pricing and total amounts


23

amount

decimal


Pricing and total amounts


24

vat

decimal


Pricing and total amounts


25

amountIncludingVAT

decimal


Pricing and total amounts


26

vendorNo

string

20



27

externalProducer

string

20



28

netWeight

decimal




29

netWeightBWU

decimal


TODO: Is this needed?


30

lastModified

datetime


Timestamp of last modification



Example Object

JSON
{
    "@odata.etag": "W/\"JzIwOzE0NTI4MDI2MDc2NzYyMzU0Mjc0MTswMDsn\"",
    "systemId": "de661423-7eaf-f011-b028-99c8bc4e8b83",
    "documentType": "Delivery",
    "documentNo": "DS-034",
    "lineNo": 40000,
    "type": "Item",
    "itemNo": "70065",
    "description": "Fiskinaggar ",
    "locationCode": "BLUE",
    "stockCenterCode": "",
    "lotFilter": "",
    "lotFilterOriginal": "",
    "noOfTradeItems": 60,
    "tradeItemUnit": "PACK",
    "quantity": 600,
    "unitOfMeasureCode": "PCS",
    "quantityBase": 600,
    "noOfPallets": 0,
    "unitPrice": 23.153,
    "purchPriceToVendor": 0,
    "lineAmount": 13891.8,
    "lineDiscount": 0,
    "lineDiscountAmount": 0,
    "amount": 13891.8,
    "vat": 0,
    "amountIncludingVAT": 13891.8,
    "vendorNo": "",
    "externalProducer": "",
    "netWeight": 5,
    "netWeightBWU": 3000,
    "lastModified": "2025-10-28T09:30:22.037Z"
}


Usage

Read lines of a document

To read the lines with a filter on a single document:

JSON
GET
[server]/api/wisefish/wiFiEP/v1.0/companies([CompanyGUID])/salesAgreementLines?$filter=documentNo eq 'DS-034'
Expand to see the example json

Reponse:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/salesAgreementLines",
    "value": [
        {
            "@odata.etag": "W/\"JzIwOzE0NTI4MDI2MDc2NzYyMzU0Mjc0MTswMDsn\"",
            "systemId": "de661423-7eaf-f011-b028-99c8bc4e8b83",
            "documentType": "Delivery",
            "documentNo": "DS-034",
            "lineNo": 40000,
            "type": "Item",
            "itemNo": "70065",
            "description": "Fiskinaggar ",
            "locationCode": "BLUE",
            "stockCenterCode": "",
            "lotFilter": "",
            "lotFilterOriginal": "",
            "noOfTradeItems": 60,
            "tradeItemUnit": "PACK",
            "quantity": 600,
            "unitOfMeasureCode": "PCS",
            "quantityBase": 600,
            "noOfPallets": 0,
            "unitPrice": 23.153,
            "purchPriceToVendor": 0,
            "lineAmount": 13891.8,
            "lineDiscount": 0,
            "lineDiscountAmount": 0,
            "amount": 13891.8,
            "vat": 0,
            "amountIncludingVAT": 13891.8,
            "vendorNo": "",
            "externalProducer": "",
            "netWeight": 5,
            "netWeightBWU": 3000,
            "lastModified": "2025-10-28T09:30:22.037Z"
        }
    ]
}


Add a line to a document

To add a new line on a sales agreement:

JSON
POST
[server]/api/wisefish/wiFiEP/v1.0/companies([CompanyGUID])/salesAgreementLines

{
    "documentNo": "DS-037",
    "itemNo": "70079",
    "quantity": 10,
    "unitOfMeasure": "BOX"
}

A successful request will…

  • Create a new line on the given agreement

  • Line No. is generated automatically

If the agreement is closed or in posting, an error is returned and a line cannot be added.



Specific modification methods

A vew service-enabled procedures are available to make modification of a specific line easier.

The record ID is systemId of the line so that must be retrieved first in order to use these endpoints.


Update Quantity

This method makes possible to use POST and only give one parameter, the new quantity.

This will be validated into field “Quantity” in BC which is the quantity in the base unit of measure for the Item.

JSON
POST
[server]/api/wisefish/wiFiEP/v1.0/companies([CompanyGUID])
  /salesAgreementLines([record-id])/Microsoft.NAV.updateQuantity

Body:
{
  "updateQty": 100
}

Parameters


quantity

The new quantity


Update Unit Price

This method makes possible to use POST and only give one parameter, the new unit price. This will be validated into field “Unit Price” in BC.

JSON
POST
[server]/api/wisefish/wiFiEP/v1.0/companies([CompanyGUID])
  /salesAgreementLines([record-id])/Microsoft.NAV.updateUnitPrice

Body:
{
  "updatePrice": 12.50  
}

Parameters


updatePrice

The new price


Update Quantity and Unit Price

This method makes possible to use POST and only give both new quantity and price. Same as using both methods above.

JSON
POST
[server]/api/wisefish/wiFiEP/v1.0/companies([CompanyGUID])
  /salesAgreementLines([record-id])/Microsoft.NAV.updateQuantityAndUnitPrice

Body:
{
  "updateQty": 100,
  "updatePrice": 12.50
}

Parameters


quantity

The new quantity

updatePrice

The new price


Reserving Pallets

Reserve Pallet

This method is used to reserve a pallet to the sales line:

JSON
POST
.../salesAgreementLines([record-id])/Microsoft.NAV.reservePallet

Body:
{
    "palletBarcode" : "00066666666000000141"
}

Parameters


palletBarcode

The barcode, which is the primary key of the pallet table.

If successful, the pallet is shown on the Delivery Agreement as reserved.

The trade items on the pallet, become reserved automatically.


Release Pallet

To remove the reservation, this method is used:

JSON
POST
.../salesAgreementLines([record-id])/Microsoft.NAV.releasePallet

Body:
{
    "palletBarcode" : "00066666666000000141"
}

Parameters


palletBarcode

The barcode, which is the primary key of the pallet table.

If successful, the pallet is no longer reserved on the Agreement.

The Trade Items are also released.