My Products
Help
iizy
CONTRIBUTOR **

Create order with number provided

by iizy

Hi,

I'm wondering if it is possible to create an order and provided number? 

 

I was trying to do it and I received the following error message:  "A record with the same primary key already exists." despite the fact that the order with provided number doesn't exist.

 

mutation CreateOrder($companyId: Int) {
  useCompany(no: $companyId) {
    order_create( values: [
        {
        orderNo: 99,
        orderType: 1,
        name: "Test order",
        orderDateAsDate: "2024-03-10",
        customerNo: 99999999,
        orgUnit2: 125
}
    ]) {
        affectedRows
        items {
            orderNo			
            name			
            customerNo			
            orderDateAsDate
         }
      }
   }
}

 

Response:

 

{
    "errors": [
        {
            "message": "A record with the same primary key already exists.",
            "path": [
                "useCompany",
                "order_create",
                "values/0"
            ],
            "extensions": {
                "data": {
                    "status": 3,
                    "status_name": "PrimaryKeyAssignmentFailed"
                }
            }
        }
    ],
    "data": {
        "useCompany": {
            "order_create": {
                "affectedRows": 0,
                "items": null
            }
        }
    },
    "extensions": {
        "vbnxt-trace-id": "00000000000000007438f11cafe2fdb3"
    }
}

 

1 REPLY 1
Accepted solution
Marius Bancila
VISMA

by Marius Bancila

This depends on a setting from the Customer Information table. There is a field called "Next on + only" in English. If you have Order no. checked, then you cannot provide an order number, it can only be assigned by the system.

image.png