My Products
Help
JUKKA BLOMQVIST
CONTRIBUTOR ***

SalesOrder customer contact v3

by JUKKA BLOMQVIST

When we post SalesOrder we get error "Invalid Customer Contact, or Customer Contact not found". We have lots of customers without contact and we do not want to open a contact to all customers. How we can bypass this error?

8 REPLIES 8

by Magnus Johnsen (Updated ‎18-12-2023 16:02 by Magnus Johnsen VISMA )

Hi,

There were a couple of issues with your JSON:

  • Ordertype SO does not support the "orderID" field
  • It's not possible to set discountCode, discountPercent and discountAmount in the same request

This will still generate an issue if you try to create a shipment from this as it has no warehouse, for more information on how the drop-ship flow works i Visma.Net, please have a look at this article:

Create a drop-ship order flow

 

Try using the JSON below:

 

{
    "type": "SO",
    "date": "2023-12-14T00:00:00",
    "requestOn": "0001-01-01T00:00:00",
    "cancelBy": "0001-01-01T00:00:00",
    "description": "Prog-It testi",
    "status": "Open",
    "customer": {
        "id": "10001",
        "order": "10905"
    },
    "shipping": {
        "scheduledDate": "0001-01-01T00:00:00",
        "contact": {
            "name": "JSC Tehnoinform"
        },
        "intrastatTransactionTypeId": 0,
        "residentialDelivery": false,
        "saturdayDelivery": false,
        "insurance": false,
        "priority": 0
    },
    "orderLines": [
        {
            "inventoryId": "nonstocktest",
            "description": "Coated Paper Stocklot",
            "unitOfMeasure": "STK",
            "quantity": 23.762,
            "unitCost": 0,
            "unitPrice": 855,
            "undershipThreshold": 0,
            "overshipThreshold": 100,
            "shipDate": "0001-01-01T00:00:00",
            "requestDate": "0001-01-01T00:00:00",
            "note": "Coated Paper Stocklot, 35 RO, 0 PX, 23762 KG NET/23762 KG GROSS, 48101300 CUSTOM CODE",
            "hasManualPrice": true,
            "commissionable": false,
            "supplierPrice": 0
        }
    ],
    "useReplacementCostForMarginAndProfit": false,
    "originalOrderId": "10905"
}

 

 

JUKKA BLOMQVIST
CONTRIBUTOR ***

That gave us "Order Type requires (manually generated) Order-Id" - what's the right type?

Hi,

In that case you don't have automatic numbering on your SO's, please disregard my comment about the field and include it in your request.

Thank you. 

JUKKA BLOMQVIST
CONTRIBUTOR ***

Hello,

 

Finally managed to get all working! Still one more question, how do I get a list of non-stock-items? I tried with/w-o the warehouse id api/v3/Inventory, but gives me a list of "normal" items (we have only one for test purposes..)?

Accepted solution
Magnus Johnsen
VISMA

Hi,

Good to hear!
Currently it's not possible to use the salesOrder nextGen service for non-stock items.

We have an improvement case in the backlog for this, I've informed the developers that you have also requested this feature.

Accepted solution
Magnus Johnsen
VISMA

by Magnus Johnsen

Hi,

We are not able to reproduce this issue, we're able to create salesOrders using customers without any active/default contacts:

Could you please send us the JSON you are sending in your payload?

Thank you. 

JUKKA BLOMQVIST
CONTRIBUTOR ***

Hello,

 

We also noted, that since we are using non-stock items, lines get rejected "inventoryitem xxx not found. This works in our current v1. 

 

I didn't find how to attach files, so here it is as pasted text..

 

{"type":"SO","orderId":"300010905","currencyId":null,"date":"2023-12-14T00:00:00","requestOn":"0001-01-01T00:00:00","cancelBy":"0001-01-01T00:00:00","description":"Prog-It testi","status":"Open","customer":{"id":"10001","contactId":0,"order":"10905","refNo":null,"locationId":null,"termsId":null,"gln":null},"print":null,"shipping":{"scheduledDate":"0001-01-01T00:00:00","shipSeparately":false,"rule":null,"address":null,"contact":{"name":"JSC Tehnoinform","attention":null,"phone1":null,"email":null},"preferredWarehouseId":null,"intrastatTransactionTypeId":0,"shipViaId":null,"residentialDelivery":false,"saturdayDelivery":false,"insurance":false,"priority":0,"zoneId":null,"fobPointId":null,"termsId":null},"billing":null,"financialInformation":null,"ownerId":null,"orderLines":[{"inventoryId":"1737","description":"Coated Paper Stocklot","unitOfMeasure":"TN","shippingRule":null,"quantity":23.762,"unitCost":0.0,"unitPrice":855.000,"externalLink":null,"warehouseId":null,"reasonCode":null,"taxCategoryId":null,"undershipThreshold":0,"overshipThreshold":100,"shipDate":"0001-01-01T00:00:00","requestDate":"0001-01-01T00:00:00","salesAccountId":null,"subaccount":null,"note":"Coated Paper Stocklot, 35 RO, 0 PX, 23762 KG NET/23762 KG GROSS, 48101300 CUSTOM CODE","discountCode":null,"discountPercent":0,"discountAmount":0,"hasManualDiscount":false,"warehouseLocationId":null,"operation":null,"hasManualPrice":true,"branchId":null,"commissionable":false,"salesPersonId":null,"purchaseOrderSource":null,"supplierId":null,"supplierPrice":0,"projectTaskId":null}],"taxZoneId":null,"note":null,"paymentSettings":null,"useReplacementCostForMarginAndProfit":false,"freight":null,"branchId":null,"originalOrderType":null,"originalOrderId":"10905","salesPersonId":null,"projectId":null}

JUKKA BLOMQVIST
CONTRIBUTOR ***

Hello again,

 

Problem solved, we defined answer as a class including contactID, and that's why it failed. Took away from definition and problem solved.

 

How ever, we still have this "InventoryId cannot be found or is invalid" because we are using non-stoc items, I suppose. Any ideas how to tacle that?