My Products
Help
AslakDevinco
CONTRIBUTOR **

Unexpected behaviour in lineNbr for the SalesOrder entity when deleting/adding order lines?

by AslakDevinco

Hi, 

 
 

I noticed via testing how Visma.net deals with line number (lineNbr) for the SalesOrder entity when deleting and adding a new order line. In some cases the lineNbr property is reset to the value of a deleted order line. I wonder if this is expected behaviour? 

This has some unfortunate consequences for our integration, as we keep the lineNbr property as part of the unique orderLine "id" from Visma in our system. So if the value of lineNbr stays unchanged after deleting an orderline and adding a new one, the "link" between the order line in our system and the order line in Visma is basically broken. 

Attached is two json-files (dumps from Postman) illustrating the problem. The file "initWithOneOrderLine" contains the sales order in its initial state with one order line. 

The file "lineOneDeletedLineTwoAdded" contains the sales order after the initial order line is deleted and a new order line is added. As you can see, the value of the lineNbr property is 1 in both cases, whereas I would expect it to have a value of 2 after line 1 was deleted and a new line was added. Is this expected behaviour?

 

Regards, 

Aslak Kvestad, Devinco AS

21 REPLIES 21

by Magnus Johnsen

Hi,

 

We'll have a look at this and get back to you. 

Hi,

We are not able to reproduce this in our local test.

 

We tried this with both stock & non-stock items.

 

Steps taken Stock item lines: Non-stock item lines:
SO created with 1 line Item on line 1, allocation on line 2 Item on line 1
PUT line delete Empty Empty
PUT insert line Item on line 3, allocation on line 4 Item on line 2

 

Could you please share the JSON that was used to deleted & insert the lines?

AslakDevinco
CONTRIBUTOR **

Hi, 

 

The lines were created and deleted in the Visma.net GUI, see attached image dump.

 

Hi,

 

Even when trying this in the UI we are not able to reproduce the issue, please see attached.

 

As this case is in regards to the UI functionality, we would recommend that you get in contact with the ERP support as we on the development team handle API related cases. 

We would agree this is abnormal behaviour, the lineNumber should be incrementing both when deleted/inserted from UI and API.

AslakDevinco
CONTRIBUTOR **

Hmmm... That is strange. In my case this behaviour is consistent. It happens every time. This is what I do (all steps below are done in the GUI): 

1. Create a new sales order (order type is SO in my case). Click save before adding an order line.

2. Add one order line and click save. In my test I add an order line with unit "TIME". 

3. Delete the order line and click the add button again. I do not save the sales order in between. 

4. The Line Number property is still 1, see attachments. 

 

I understand that this is not directly related to the API, but it still causes some trouble for us in our integration with Visma.net. 

How do I get in contact with the ERP support? 

As the API will follow the behaviour of the UI, ultimately, all cases concerning the UI will also affect the API.

Are you seeing this issue on all companies or is it only on one?

 

In my test, I tried the same steps as you as well as saving between each step and the result is the same, when adding a line, my lineNumbers increase. 

 

In this post are the contact details:

Contacting the Visma.Net ERP Support / Partner Service

Anonymous
Not applicable

by Anonymous

Hi everyone,

 

We added externalLink to OrderLine in order to solve this exact issue. External system line ID should always be added as externalLink in order to preserve traceability through the order process. The externalLink will never be altered by Visma.net and it is not editable in GUI. It will be copied automatically to the corresponding line in shipment and invoice.

 

Please read my reply in ERP community:

 

https://community.visma.com/t5/Diskusjon-i-Visma-net-ERP/Uventet-oppforsel-for-quot-Linjenr-quot-i-s...

 

 

AslakDevinco
CONTRIBUTOR **

by AslakDevinco

Hi, 

 

A comment regarding externalLink: It is editable in the GUI, at least in my test-environment. Is this the case for the Visma.net production environment as well?

Yıldırım
VISMA

by Yıldırım (Updated ‎19-08-2020 10:33 by Yıldırım VISMA )

Hi Aslak, 

please see my previous reply above regarding its properties.

AslakDevinco
CONTRIBUTOR **

by AslakDevinco

Oops, sorry about that! Thank's Yildirim!

Yıldırım
VISMA

by Yıldırım

No worries ! Please let us know if you need any further assistance about that 🙂

AslakDevinco
CONTRIBUTOR **

by AslakDevinco

One more thing that I discovered during testing: 

User creates an order line in the Visma GUI. The order line is imported to our solution, and our integration updates the order line with some unique value in the externalLink field. To do this update, the API requires that lineNbr is sent with the update request. If not, we get the following error message: 

"message":"Cannot update salesOrder line without line number"

 

So we're back to the lineNbr problem again. Imagine if the user deletes the order line in the GUI (let's say the lineNbr is 1), then adds a new order line, and this order line gets the same lineNbr value (i.e. 1) as before (this was my original problem when I started this thread). Let's imagine that this "delete-add new line" sequence in the GUI happens BEFORE our integration has updated the original order line (with a value for externalLink). Then the value of externalLink from our system points to a now non-exsiting order line in Visma (as the original line with lineNbr 1 is deleted). This is a potential problem for our integration. Any thoughts on this?

 

Would it for example be possible if either lineNbr OR externalLink is required in order to update an order line? 

Yıldırım
VISMA

by Yıldırım

Hello, 

under the current setup, orderLineNbr needs to be specified for the PUT operation on SalesOrder. For now, you can make a GET request to the specific SO  in order to see actual lineNumbers before sending PUT request.

We'll also escalate this case to the development team to check possibility of whether External-Link can be used as line pointer for PUT operations on the SalesOrder.

AslakDevinco
CONTRIBUTOR **

by AslakDevinco

Hi, 

We already send a GET request to get the actual line number values. However, the problem remains as long as there is a chance that order line with lineNbr = 1 has completely different data from one GET request to the next (if the orderline has been deleted and added again like I described in my last post). 

The whole problem disappears if we can be 100% sure that deleting one order line and adding a new one ALWAYS increases the lineNbr counter. In other words, there should never be an order line with lineNbr=1 if the line with lineNbr=1 was deleted at some point. 

I encourage you to test this once again - I find it hard to believe that this only happens in my Visma.net client.

Yıldırım
VISMA

by Yıldırım (Updated ‎19-08-2020 15:41 by Yıldırım VISMA )

Hi,

SOLineNbr order depends on Visma.Net ERP / DB operations as it's mentioned here

Uventet oppførsel for "Linjenr" i salgsordre? If this behaviour needs to be reviewed then this should be addressed to the Visma.net ERP.

We've created a case for extending Sales Order PUT > orderLine selector with External-Link field.
Updates can be followed in the Ideas section: Extend Sales Order Endpoint PUT operation's SOOrderLine pointer with "External-Link" Field

Anonymous
Not applicable

by Anonymous

Hi! I have several questions on this issue.

 

1)  What about Customer Invoices? We also need this "externalLink" field for lines there also.

I see that field in the API manuals: https://integration.visma.net/API-index/

It is listed for "GET/controller/api/v1/customerinvoice/{invoiceNumber}  Get a specific Invoice"

But there's no way to set it when creating or updating Customer Invoice.

Is there a way to use it? Or is it not implemented? Is it planned to be implemented? Then when to expect it? If not, then what is the way to identify lines?

 

2) What if I update "externalLink" field for lines of Sales Orders, will Visma.Net ERP update it in other entities automatically?

 

3) Is there an API call to update/delete Sales Order line identified by it's externalLink?

 

4) When we add new line to SalesOrder/CustomerInvoice what is the way to acquire/identify it's line number?

 

Thanks in advance!

Yıldırım
VISMA

by Yıldırım (Updated ‎13-10-2020 11:50 by Yıldırım VISMA )

Hello, 

1) As of today, "externalLink" is not available with POST / PUT operations in Customer Invoice Endpoint. This is not in the backlog therefore please register a feature request at Ideas section.  

For PUT operation, the Line pointer for Customer Invoice Endpoint is 

  "lineNumber": {
        "value": 0
      },

There is also "Description" field in the lines. 

Implementation process and time may vary depending on development team's sprint planning / prioritization therefore we are unable to share any specific timeline for implementation of the feature requests.

2) No, every module in Visma.Net ERP has its own references and external fields are not connected  between different documents. They should be set separately.

 

3) Delete operation is not supported via Sales Order Endpoint in API. 

4) Making a GET request to the relevant resource and checking Line number.

GET Customer Invoice

 

...
"invoiceLines": [ 
"lineNumber": 0,
...

 

GET Sales Order

 

...
"lines": [
 "lineNbr": 0,
...

 

Anonymous
Not applicable

by Anonymous

Thanks.

 

Is there a possibility that newly created line numbers will be returned in the HTTP response? Should we send a feature request for that if we need that?

Yıldırım
VISMA

by Yıldırım

Hello, 

 

Currently, newly created asset's reference number is returned in the POST > Response Headers "Location". 

For the lineNumbers, there should be a different logic since there are scenarios of 500+ lines are being POSTED via API so this wouldn't be graceful to include all these line numbers in the response headers. They may even be overridden if user make any changes in the UI.

Please register this at the Ideas part then it can be evaluated by the team. 

Yıldırım
VISMA

by Yıldırım (Updated ‎19-08-2020 10:35 by Yıldırım VISMA )

Hello,

regarding "External Link" field, this can be used via API by including the following key-value pair in the SalesOrderLines

"externalLink": {
"value": "1"
}

Please be advised that,"External Link" field is only editable as long as document status is Open. Once the document (SO) has been associated with Shipment or Invoice then this field becomes read-only.

(Field can be displayed on the data grid after being selected from Column Configurations that is red-squared on the left)

External-link.png