Visma.net - Retrieving sales order fields for delivery

How to retrieve sales order fields for delivery on terminal

In some cases, extra fields like Customer Order No. or External Ref. may be desired as additional information fields on the delivery in the Pick module in BxMobile. In other cases, extra information may need to be sent to the shipping system (such as nShift, AxiaFrakt, Logistra, etc.) so that it appears on the shipping label or is included in the shipping system.

The Visma API does not allow us to retrieve External Ref. or Customer Order No. directly from the shipment endpoint; therefore, we need to fetch this data from the SalesOrder endpoint.

This requires setup in Imports from ERP, SQL Integration, and Export to ERP if extra information needs to be sent to the shipping system.

Imports from ERP

In BxAdmin, go to Imports from ERP → pickinglist.

Under Field Mappings, create two new fields with New Mapping. From the VismaNet salesorder endpoint, we retrieve orderNo and fill in salesorder.orderNo in the SourceField column. In Destination, BxOrder.Orderno should be used, as this is the table and column where we store information from VismaNet. 

For example, if you need data from the Customer Order No. field in VismaNet, enter salesorder.customerOrder in SourceField, and use BxOrder.CustPO, which is an available field in our database. Enabling the field activates it, but you must also enable Header Only. as the information we retrieve here is header-level data.


Alternatively, you can copy the code snippet below and paste it using CTRL-V in the correct importer to avoid manual entry.

[{"id":219,"import":4,"sourcefield":"salesorder.customerOrder","destination":"BxOrder.CustPO","destinationtype":"","static":"","enabled":true,"isprimarykey":false,"sourcerow":"","isforeignkeyto":"","importoneline":true,"required":"","ignorezero":false,"comment":null},{"id":220,"import":4,"sourcefield":"salesorder.orderNo","destination":"BxOrder.Orderno","destinationtype":"","static":"","enabled":true,"isprimarykey":false,"sourcerow":"","isforeignkeyto":"","importoneline":true,"required":null,"ignorezero":null,"comment":null}] 

SQL Integration

Next, go to SQL Integration → Pickinglist. Here, we need to join the BxOrder table and add the correct field for display on the terminal. You can see the example below for how the query should look. In this example, we named the field poref, but you can name it anything as long as the column name is correct. On line 17 in the screenshot below, we added ord.custpo poref, and on line 35, we joined the BxOrder table as follows:
left join bxorder ord on ord.orderno = (select top 1 pl.orderno from BxPickinglistLine pl where pl.pickinglist = p.pickinglist) 

Remember to click Run Query in the top right corner to ensure that the query works correctly, then click Save.

To import data into this field, you can either click Run Import on the importer in Imports from ERP (requires a more recent version of BxEngine), or open Pick in BxMobile. If you want the information you just retrieved to be visible as a separate field on the terminal, a Client UI field needs to be created for this. See our Client UI documentation on how to do this.

Export to ERP

If you want to send the retrieved data to a referance field in the shipping system, such as Consignor (nShift) On-premises, simply add an extra mapping under Export to ERPconsignor (or Axia, Logistra, shipmentserver unifaun etc. depending on what you use). 

SourceField should be filled in with the same name as we gave the column in the query earlier, in this case is poref. The field in the shipping system that should be filled in with data is called Destination.

Since the Consignor on-premises integration is file-based, it is in this case field number 23 (22 in Consignor) in the file (also requires changes in Import Setup in Consignor if mappings for the desired field are not already available there).

If the setup is towards a cloud-based shipping system, it is the API field for the shipping system that should be filled out here, e.g., References.7 in the case of Shipment Server. 

This is all that needs to be done to retrieve various fields from the sales order endpoint in the Visma API. Once these steps have been completed correctly, the desired data should be available for use in the Pick module.