My Products
Help
Anonymous
Not applicable

Trying to change location for a sales order

by Anonymous (Updated ‎09-03-2021 19:37 by Yıldırım VISMA )

Hello everyone, 

 

I'm trying to change the location of my sales order using the API. I've reviewed the JSON model and the VISMA.Net financials UI, but no success. 

 

The data I'm trying to pass in is this

 

{
"orderType": {
"value": "CS"
},
"hold": {
"value": false
},
"date": {
"value": "2021-02-17"
},
"customerRefNo": {
"value": "D344"
},
"customer": {
"value": "10003"
},
"currency": {
"value": "NOK"
},
"paymentRef": {
"value": "F43255"
},
"location": {
"id": "22",
"name": "Fredrikstad"
},
"soBillingAddress": {
"overrideAddress": true,
"addressId": 51259,
"addressLine1": "heigata 2",
"postalCode": "1602",
"city": "FREDRIKSTAD",
"country": {
"id": "NO",
"name": "NORGE"
},
"county": {
"id": "0106",
"name": "FREDRIKSTAD"
}
},
"soShippingAddress": {
"overrideAddress": false,
"addressId": 51252,
"addressLine1": "heigata 2",
"postalCode": "1602",
"city": "FREDRIKSTAD",
"country": {
"id": "NO",
"name": "NORGE"
},
"county": {
"id": "0106",
"name": "FREDRIKSTAD"
}
},

"lines": [
{
"operation": "Insert",
"lineNbr": {
"value": 1
},
"inventoryId": {
"value": "126"
},
"warehouse": {
"value": "1"
},
"uom": {
"value": "STK"
},
"quantity": {
"value": 1
},
"unitPrice": {
"value": 1000
},
"lineDescription": {
"value": "Elektrisk tannbørste"
}
}
]
}

 

The error: 

Please review the errors.\r\nError: 'Location' cannot be empty

 The location I'm trying to use for my sales order already exists in registered locations for that customer. What am I doing wrong?

13 REPLIES 13
Anonymous
Not applicable

by Anonymous

This is the screenID. I currently have 3 different locations for that customer. I want to register a new sales order on "Fredrikstad" instead of my main location. I've tried sending both the ID and name in the JSON, but I keep getting that Location is empty. 

by Yıldırım (Updated ‎22-02-2021 15:28 by Yıldırım VISMA )

Please send us your current JSON that you're trying the operation with.  Please also try the same operation in the Financials UI by creating CS type Sales Order and assigning the desired location. 

Anonymous
Not applicable

by Anonymous

{
"orderType": {
"value": "CS"
},
"hold": {
"value": false
},
"date": {
"value": "2021-02-17"
},
"customerRefNo": {
"value": "A555"
},
"customer": {
"value": "10003"
},
"currency": {
"value": "NOK"
},
"paymentRef": {
"value": "PF4433"
},

"soBillingAddress": {
"overrideAddress": true,
"addressId": 51259,
"addressLine1": "heigata 2",
"postalCode": "1602",
"city": "FREDRIKSTAD",
"country": {
"id": "NO",
"name": "NORGE"
},
"county": {
"id": "0106",
"name": "FREDRIKSTAD"
}
},

"soShippingAddress": {
"overrideAddress": false,
"addressId": 51252,
"addressLine1": "heigata 2",
"postalCode": "1602",
"city": "FREDRIKSTAD",
"country": {
"id": "NO",
"name": "NORGE"
},
"county": {
"id": "0106",
"name": "FREDRIKSTAD"
}
},

"location": {
"id": "22",
"name": "Fredrikstad"
},
"lines": [
{
"operation": "Insert",
"lineNbr": {
"value": 1
},
"inventoryId": {
"value": "124"
},
"warehouse": {
"value": "1"
},
"uom": {
"value": "STK"
},
"quantity": {
"value": 1
},
"unitPrice": {
"value": 1000
},
"lineDescription": {
"value": "Elektrisk tannbørst"
}
}
]
}

by Yıldırım (Updated ‎22-02-2021 15:45 by Yıldırım VISMA )

Location field still sent in the wrong format. There are also another syntax errors with "Address" arrays such as missing value keys & wrong  { } usage.

Please copy-paste example value format from the Sales Order POST DTO : https://integration.visma.net/API-index/

Then remove the fields you don't need. Replace the values of the fields you'd like to send with.

Anonymous
Not applicable

by Anonymous

I've tried to only send the Location model with the other necessary values, but still can't seem to get it to work, Whats wrong about my location format? By looking at the UI I see theres a "connection number" from my customer? If you take a look at this; 

 

{
    "orderType": {
        "value": "CS"
    },
    "hold": {
        "value": false
    },
    "date": {
        "value": "2021-02-17"
    },
    "customerRefNo": {
        "value": "A555"
    },
    "customer": {
        "value": "10003"
    },
    "currency": {
        "value": "NOK"
    },
    "paymentRef": {
    "value": "PF4433"
  },

    "location": {
    "id": "22",
    "name": "Fredrikstad"
  },

   "lines": [
        {
            "operation": "Insert",
            "lineNbr": {
                "value": 1
            },
            "inventoryId": {
                "value": "124"
            },
            "warehouse": {
                "value": "1"
            },
            "uom": {
                "value": "STK"
            },
            "quantity": {
                "value": 1
            },
            "unitPrice": {
                "value": 1000
            },
            "lineDescription": {
                "value": "Elektrisk tannbørst"
            }
        }
    ]
}

 

by Yıldırım

The correct definitions of the key-value pairs are represented in the Swagger Documentation for Visma.net ERP API that can be found at https://integration.visma.net/API-index/

You need to open the link  > find Sales Order POST endpoint and check Example Value information to find out correct syntax.

As we've stated above, Location can not be sent in this format. 

"location": {
    "id": "22",
    "name": "Fredrikstad"
  },

 
Correct format is 

  "location": {
    "value": "string"
  },

 where you have to replace "string" with desired "LOCATION ID" 

Anonymous
Not applicable

by Anonymous

I see, the thing is... I've already tried that aswell and it still gives me the same error message. 

 

Like this:

"location": {
    "id": "22"
  },
Accepted solution
Yıldırım
VISMA

by Yıldırım (Updated ‎26-02-2021 17:30 by Yıldırım VISMA )

 Please pay extra attention to the above shared information and the format.  

"location": {
    "value": "yourLocationID"
  }, 

by Yıldırım

Hello, 

 

You should only include the fields that you'd like to update their values in the PUT (Update) requests. The rest should be excluded from your JSON.  

Please see the documentation for the syntax: https://integration.visma.net/API-index/
2021-02-22 14_27_58-Window.png

Field should be sent in the following format:

...
"location": {
"value": "string"
},
...

 

Anonymous
Not applicable

by Anonymous

Oh sorry just realised the question I asked was a bit vague. I'm trying to add a completely new sales order, not update. I want to add the new sales order with one of my other three exisiting locations registered for that customer if that makes sense. 

by Yıldırım

Hello, this is also valid for POST operation. You should correct the syntax used in your JSON.  

Used

"location": {
"id": "22",
"name": "Fredrikstad"
},


Should be used:

  "location": {
    "value": "string"
  },
Anonymous
Not applicable

by Anonymous

I'm still getting the same error that Location can't be empty. 

by Yıldırım

Please send us the latest POST payload that you've corrected and retried. Make sure that existing / assigned location ID sent in the JSON.

Financials UI>Customer Card: ScreenId=AR303000
2021-02-22 14_50_17-Window.png