My Products
Help
Gabriella Hennings
CHAMPION *

Error when updating receipt with allocations

by Gabriella Hennings

When trying to update a receipt that has been connected to a purchase order, i get the following error:

"One or more lines contain unassigned location and/or lot/serial number"

 

Sometimes it works, and sometimes it doesn't.

{
  
lines: [
    
{
      
allocations: [
        
{
          
operation: 'Insert',
          
lineNbr: null,
          
location: null,
          
lotSerialNumber: '2000.264',
          
quantity: 65,
          
uom: null,
          
expirationDate: null
        }
      ],
      
operation: 'Update',
      
lineNbr: 1,
      
lineType: null,
      
branchId: null,
      
branchNumber: null,
      
inventoryId: null,
      
warehouseId: null,
      
locationId: null,
      
transactionDescription: null,
      
uom: null,
      
receiptQty: null,
      
unitCost: null,
      
extCost: null,
      
discountPercent: null,
      
discountAmount: null,
      
manualDiscount: null,
      
discountCodeId: null,
      
amount: null,
      
taxCategoryId: null,
      
accountId: null,
      
accountDescription: null,
      
subaccount: null,
      
actualAccountId: null,
      
actualSubaccount: null,
      
projectId: null,
      
projectTaskId: null,
      
expirationDate: null,
      
lotSerialNumber: null,
      
poOrderType: null,
      
poOrderNbr: null,
      
poOrderLineNbr: null,
      
transferOrderType: null,
      
transferOrderNbr: null,
      
transferOrderLineNbr: null,
      
completePoLine: null
    },
    
{
      
allocations: [
        
{
          
operation: 'Insert',
          
lineNbr: null,
          
location: null,
          
lotSerialNumber: '2000.265',
          
quantity: 170,
          
uom: null,
          
expirationDate: null
        }
      ],
      
operation: 'Update',
      
lineNbr: 2,
      
lineType: null,
      
branchId: null,
      
branchNumber: null,
      
inventoryId: null,
      
warehouseId: null,
      
locationId: null,
      
transactionDescription: null,
      
uom: null,
      
receiptQty: null,
      
unitCost: null,
      
extCost: null,
      
discountPercent: null,
      
discountAmount: null,
      
manualDiscount: null,
      
discountCodeId: null,
      
amount: null,
      
taxCategoryId: null,
      
accountId: null,
      
accountDescription: null,
      
subaccount: null,
      
actualAccountId: null,
      
actualSubaccount: null,
      
projectId: null,
      
projectTaskId: null,
      
expirationDate: null,
      
lotSerialNumber: null,
      
poOrderType: null,
      
poOrderNbr: null,
      
poOrderLineNbr: null,
      
transferOrderType: null,
      
transferOrderNbr: null,
      
transferOrderLineNbr: null,
      
completePoLine: null
    },
    
{
      
allocations: [
        
{
          
operation: 'Insert',
          
lineNbr: null,
          
location: null,
          
lotSerialNumber: '2000.266',
          
quantity: 78,
          
uom: null,
          
expirationDate: null
        }
      ],
      
operation: 'Update',
      
lineNbr: 3,
      
lineType: null,
      
branchId: null,
      
branchNumber: null,
      
inventoryId: null,
      
warehouseId: null,
      
locationId: null,
      
transactionDescription: null,
      
uom: null,
      
receiptQty: null,
      
unitCost: null,
      
extCost: null,
      
discountPercent: null,
      
discountAmount: null,
      
manualDiscount: null,
      
discountCodeId: null,
      
amount: null,
      
taxCategoryId: null,
      
accountId: null,
      
accountDescription: null,
      
subaccount: null,
      
actualAccountId: null,
      
actualSubaccount: null,
      
projectId: null,
      
projectTaskId: null,
      
expirationDate: null,
      
lotSerialNumber: null,
      
poOrderType: null,
      
poOrderNbr: null,
      
poOrderLineNbr: null,
      
transferOrderType: null,
      
transferOrderNbr: null,
      
transferOrderLineNbr: null,
      
completePoLine: null
    },
    
{
      
allocations: [
        
{
          
operation: 'Insert',
          
lineNbr: null,
          
location: null,
          
lotSerialNumber: '2000.267',
          
quantity: 41,
          
uom: null,
          
expirationDate: null
        }
      ],
      
operation: 'Update',
      
lineNbr: 4,
      
lineType: null,
      
branchId: null,
      
branchNumber: null,
      
inventoryId: null,
      
warehouseId: null,
      
locationId: null,
      
transactionDescription: null,
      
uom: null,
      
receiptQty: null,
      
unitCost: null,
      
extCost: null,
      
discountPercent: null,
      
discountAmount: null,
      
manualDiscount: null,
      
discountCodeId: null,
      
amount: null,
      
taxCategoryId: null,
      
accountId: null,
      
accountDescription: null,
      
subaccount: null,
      
actualAccountId: null,
      
actualSubaccount: null,
      
projectId: null,
      
projectTaskId: null,
      
expirationDate: null,
      
lotSerialNumber: null,
      
poOrderType: null,
      
poOrderNbr: null,
      
poOrderLineNbr: null,
      
transferOrderType: null,
      
transferOrderNbr: null,
      
transferOrderLineNbr: null,
      
completePoLine: null
    },
    
{
      
allocations: [
        
{
          
operation: 'Insert',
          
lineNbr: null,
          
location: null,
          
lotSerialNumber: '2000.268',
          
quantity: 283.2,
          
uom: null,
          
expirationDate: null
        }
      ],
      
operation: 'Update',
      
lineNbr: 5,
      
lineType: null,
      
branchId: null,
      
branchNumber: null,
      
inventoryId: null,
      
warehouseId: null,
      
locationId: null,
      
transactionDescription: null,
      
uom: null,
      
receiptQty: null,
      
unitCost: null,
      
extCost: null,
      
discountPercent: null,
      
discountAmount: null,
      
manualDiscount: null,
      
discountCodeId: null,
      
amount: null,
      
taxCategoryId: null,
      
accountId: null,
      
accountDescription: null,
      
subaccount: null,
      
actualAccountId: null,
      
actualSubaccount: null,
      
projectId: null,
      
projectTaskId: null,
      
expirationDate: null,
      
lotSerialNumber: null,
      
poOrderType: null,
      
poOrderNbr: null,
      
poOrderLineNbr: null,
      
transferOrderType: null,
      
transferOrderNbr: null,
      
transferOrderLineNbr: null,
      
completePoLine: null
    },
    
{
      
allocations: [
        
{
          
operation: 'Insert',
          
lineNbr: null,
          
location: null,
          
lotSerialNumber: '2000.269',
          
quantity: 106.8,
          
uom: null,
          
expirationDate: null
        }
      ],
      
operation: 'Update',
      
lineNbr: 6,
      
lineType: null,
      
branchId: null,
      
branchNumber: null,
      
inventoryId: null,
      
warehouseId: null,
      
locationId: null,
      
transactionDescription: null,
      
uom: null,
      
receiptQty: null,
      
unitCost: null,
      
extCost: null,
      
discountPercent: null,
      
discountAmount: null,
      
manualDiscount: null,
      
discountCodeId: null,
      
amount: null,
      
taxCategoryId: null,
      
accountId: null,
      
accountDescription: null,
      
subaccount: null,
      
actualAccountId: null,
      
actualSubaccount: null,
      
projectId: null,
      
projectTaskId: null,
      
expirationDate: null,
      
lotSerialNumber: null,
      
poOrderType: null,
      
poOrderNbr: null,
      
poOrderLineNbr: null,
      
transferOrderType: null,
      
transferOrderNbr: null,
      
transferOrderLineNbr: null,
      
completePoLine: null
    },
    
{
      
allocations: [
        
{
          
operation: 'Insert',
          
lineNbr: null,
          
location: null,
          
lotSerialNumber: '2000.270',
          
quantity: 44,
          
uom: null,
          
expirationDate: null
        }
      ],
      
operation: 'Update',
      
lineNbr: 7,
      
lineType: null,
      
branchId: null,
      
branchNumber: null,
      
inventoryId: null,
      
warehouseId: null,
      
locationId: null,
      
transactionDescription: null,
      
uom: null,
      
receiptQty: null,
      
unitCost: null,
      
extCost: null,
      
discountPercent: null,
      
discountAmount: null,
      
manualDiscount: null,
      
discountCodeId: null,
      
amount: null,
      
taxCategoryId: null,
      
accountId: null,
      
accountDescription: null,
      
subaccount: null,
      
actualAccountId: null,
      
actualSubaccount: null,
      
projectId: null,
      
projectTaskId: null,
      
expirationDate: null,
      
lotSerialNumber: null,
      
poOrderType: null,
      
poOrderNbr: null,
      
poOrderLineNbr: null,
      
transferOrderType: null,
      
transferOrderNbr: null,
      
transferOrderLineNbr: null,
      
completePoLine: null
    },
    
{
      
allocations: [
        
{
          
operation: 'Insert',
          
lineNbr: null,
          
location: null,
          
lotSerialNumber: '2000.271',
          
quantity: 26,
          
uom: null,
          
expirationDate: null
        }
      ],
      
operation: 'Update',
      
lineNbr: 8,
      
lineType: null,
      
branchId: null,
      
branchNumber: null,
      
inventoryId: null,
      
warehouseId: null,
      
locationId: null,
      
transactionDescription: null,
      
uom: null,
      
receiptQty: null,
      
unitCost: null,
      
extCost: null,
      
discountPercent: null,
      
discountAmount: null,
      
manualDiscount: null,
      
discountCodeId: null,
      
amount: null,
      
taxCategoryId: null,
      
accountId: null,
      
accountDescription: null,
      
subaccount: null,
      
actualAccountId: null,
      
actualSubaccount: null,
      
projectId: null,
      
projectTaskId: null,
      
expirationDate: null,
      
lotSerialNumber: null,
      
poOrderType: null,
      
poOrderNbr: null,
      
poOrderLineNbr: null,
      
transferOrderType: null,
      
transferOrderNbr: null,
      
transferOrderLineNbr: null,
      
completePoLine: null
    }
  ],
  
landedCost: null,
  
receiptType: null,
  
receiptNbr: '004044',
  
hold: false,
  
date: null,
  
postPeriod: null,
  
warehouseId: null,
  
supplierId: null,
  
locationId: null,
  
currency: null,
  
exchangeRate: null,
  
createBill: null,
  
supplierRef: null,
  
controlQty: null,
  
controlAmount: null,
  
branchNumber: null
}

 

 

Best regards
Gabriella Hennings
Cloud Connection AB
5 REPLIES 5
Yıldırım
VISMA

by Yıldırım

Hello, 

please send us the latest version of your JSON and the CompanyID <developersupport@visma.com>

Yıldırım
VISMA

by Yıldırım

@Gabriella Hennings wrote:

 

 

1) Sometimes it works, and sometimes it doesn't.

What do you mean by separating the update and insert allocations?  I can't update the purchaseorderline receiptQty at the same time as inserting the allocations?

 

2) I also sometimes get the error "Error updating purchase receipt. Document with number 000015 could not be found" or "Error releasing purchase receipt Document with number 000016 could not be found" when trying to update or release a receipt even though i can see that the receipt exist in Visma.

 


 

1)
First PUT: Insert Allocations

Second PUT: Update if necessary


2) Please check the receipt type (Document Type)

[ PoReceipt, PoReturn, TransferReceipt ]

 

In your JSON you're opening Allocations [] array multiple times for each line, you should only have one array and add lines under that. Please see the sample payload below. 

 

View more
{
    "receiptType": {
        "Value": "PoReceipt"
    },
    "lines": [
        {
            "allocations": [
                {
                    "operation": "2",
                    "lineNbr": {
                        "value": 1
                    },
                    "location": {
                        "value": "1"
                    },
                    "lotSerialNumber": {
                        "value": "123"
                    },
                    "quantity": {
                        "value": 5
                    },
                    "uom": {
                        "value": "STK"
                    },
                    "expirationDate": {
                        "value": "2020-08-20T08:47:35.253Z"
                    }
                },
                {
                    "operation": "2",
                    "lineNbr": {
                        "value": 1
                    },
                    "location": {
                        "value": "1"
                    },
                    "lotSerialNumber": {
                        "value": "1234"
                    },
                    "quantity": {
                        "value": 5
                    },
                    "uom": {
                        "value": "STK"
                    },
                    "expirationDate": {
                        "value": "2020-08-20T08:47:35.253Z"
                    }
                },
                {
                    "operation": "2",
                    "lineNbr": {
                        "value": 3
                    },
                    "location": {
                        "value": "1"
                    },
                    "lotSerialNumber": {
                        "value": "12345"
                    },
                    "quantity": {
                        "value": 5
                    },
                    "uom": {
                        "value": "STK"
                    },
                    "expirationDate": {
                        "value": "2020-08-20T08:47:35.253Z"
                    }
                }
            ],
            "operation": "2",
            "lineNbr": {
                "value": 1
            },
            "receiptQty": {
                "Value": 16
            }
        }
    ]
}

 

Gabriella Hennings
CHAMPION *

I have one allocation array for each line. Where do you see that i have multiple allocation arrays for each line?

 

And as i stated before, this works like 90% of the times. Sometimes it just wont work the first time, but it does the second.

Best regards
Gabriella Hennings
Cloud Connection AB
Yıldırım
VISMA

by Yıldırım

Hello, in the first place , please remove all the fields having Null values from your JSON. After that, please separate your Insert Allocation Lines and send Update lines in a different request. 

Gabriella Hennings
CHAMPION *

by Gabriella Hennings (Updated ‎09-04-2023 13:31 by Gabriella Hennings )

I will try to remove all the null values to see if that has any impact. Although it's weird that it even works sometimes to update the receipt if those values being null is the problem. I would expect the error to appear every time.  Now around 70% of the time it works.

 

What do you mean by separating the update and insert allocations?  I can't update the purchaseorderline receiptQty at the same time as inserting the allocations?

 

I also sometimes get the error "Error updating purchase receipt. Document with number 000015 could not be found" or "Error releasing purchase receipt Document with number 000016 could not be found" when trying to update or release a receipt even though i can see that the receipt exist in Visma.net.

 

Sometimes retrying updating and releaseing new receipt to the same purchsaeorder WORKS.

This seems highly unreliable and frankly very difficult to even be able to build reliable integrations to Visma.net.

Best regards
Gabriella Hennings
Cloud Connection AB