My Products
Help
Stefan Hult
PARTNER

Strange error codes when updating Discount

by Stefan Hult

Hi

I want to change prices with the Discount endpoint.

The scenario is the following. Marked in red are the information I want to change.

 

StefanHult_0-1650633461540.png

 

Using this update:

StefanHult_1-1650633619200.png

Gives me the anwer:
"message": "VismaId: 8564dedf-1e67-4a45-8f69-49671b637b65. Handle(Visma.net.ERP.Api.AR.CommandModel.Commands.ChildCommands.UpdateCustomerDiscountLineCommand cmd) not found"
And it doesn't mater if I use "pendingdiscountAmount" etc. I get the same error message.

 

Changing the "Operator" to "Insert", gives me another error:
"message": "Field 'Pending Discount Amount' cannot be updated because is not visible or editable."
I get the same error if I tries to POST a new record.

Any suggestions?

 

 

 

3 REPLIES 3
Stefan Hult
PARTNER

by Stefan Hult

Hi Magnus

 

These just got weird...
First problem

I followed your instructions and deleted a record and tried to Post it:

 
{
  "discountCode": {
    "value": "TEST2"
  },
  "series": {
    "value": "1"
  },

 "discountBreakpoints": [
    {
      "operation": "Insert",
      "lineNbr": {
        "value": 1
      },
      "pendingBreakAmount": {
        "value": 5
      },
      "pendingDate": {
        "value": "2022-04-25T06:40:34.062Z"
      },
      "pendingDiscountPercent": {
        "value": 10
      }
    }
  ]
}
 
Using the operator "Update" didn't work for me. But using "Insert" worked.
But what happen??
The series is not "1" but "TEST20001"!
StefanHult_0-1650873095431.png

 

Second problem

 

When it comes to adding lines.

Adding new lines work fine, but the result is not so good.

StefanHult_2-1650873556411.png

Give you a new series instead.

StefanHult_3-1650873608950.png

 

 I can't imagine this is correct. 🙂

 


 

Hi,

You don't need to delete the whole discount, only the line that you wanted to update originally.

Do this with the line operator "delete" via a put call.

The numbering when inserting is omitted, as with other endpoints as well, it is only taken into account when you are using "Update" or "Delete" operators. 

The series value gets set according to your settings in the discount code window, if it's set to autonumbering and the conditions of the discount is different from the other series it will be autogenerated:

2022-04-25 10_54_21-Settings.png

by Magnus Johnsen

Hi,

We can confirm that there seems to be an issue using the line operator "Update", we will report this to the development team.

On our end we are not having any issues using the "Insert" operator, below example works, and until fixed the workaround would be to insert a new line and delete the old line if needed:

{
  "discountCode": {
    "value": "1"
  },
  "series": {
    "value": "10001"
  },

 "discountBreakpoints": [
    {
      "operation": "Update",
      "lineNbr": {
        "value": 1
      },
      "pendingBreakAmount": {
        "value": 5
      },
      "pendingDate": {
        "value": "2022-04-25T06:40:34.062Z"
      },
      "pendingDiscountPercent": {
        "value": 10
      }
    }
  ]
}