to get a personalized navigation.
to get a personalized navigation.
Hi,
We are trying to post some ordres in visma.net and get this errormessage - any suggestions whats causing this?
Error creating salesOrder. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> PX.Data.PXForeignRecordDeletedException: Error: The record has been deleted. at PX.Data.PXSelectorAttribute.SubstituteKeyFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) at PX.Data.PXDimensionSelectorAttribute.FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) at PX.Objects.IN.CrossItemAttribute.FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) in D:\Data\BuildAgent\work\11023e52ea15d342\Web\Pure\PX.Objects\IN\Descriptor\Attribute.cs:line 8157 at PX.Data.PXCache.OnFieldUpdating(String name, Object row, Object& newValue) at PX.Data.PXCache`1.SetValueExt(Object data, String fieldName, Object value) --- End of inner exception stack trace --- at Visma.net.ERP.Api.Base.BaseDomain.HandleChildCommand(IBaseCommand cmd, Boolean handleChildCommands) in D:\Data\BuildAgent\work\11023e52ea15d342\Web\Lib\Visma.net.ERP.Api\Base\BaseDomain.cs:line 72 at Visma.net.ERP.Api.Base.BaseDomain.ApplyChildCommands(IEnumerable`1 childCommands, Boolean handleChildCommands) in D:\Data\BuildAgent\work\11023e52ea15d342\Web\Lib\Visma.net.ERP.Api\Base\BaseDomain.cs:line 44 at Visma.net.ERP.Api.SO.CommandModel.SoCommandHandler.Handle_V2(ICreateSalesOrderCommand[] cmdList) in D:\Data\BuildAgent\work\11023e52ea15d342\Web\Lib\Visma.net.ERP.Api\SO\CommandModel\SoCommandHandler.cs:line 83 at Visma.net.ERP.Web.Api.Repositories.SOOrderWebRepository.CreateSaleOrderReturnSaleOrderNumber(SalesOrderUpdateDto salesOrderUpdateDto, String orderType, Int32 version) in D:\Data\BuildAgent\work\11023e52ea15d342\Web\Lib\Visma.net.ERP.Web.Api\Repositories\SOOrderWebRepository.cs:line 178 Error: The record has been deleted.
Hello Arne,
in the first place, the syntax of the JSON you've shared is incorrect. Data should be passed with key & value pairs. Please see the swagger documentation (POST /controller/api/v2/salesorder - Example Value ) and the example JSON below.
{
"orderType": {
"value": "SO"
},
"hold": {
"value": true
},
"date": {
"value": "2021-08-01T00:00:00"
},
"requestOn": {
"value": "2021-08-31T00:00:00"
},
"customer": {
"value": "10034"
},
"description": {
"value": "Inngående ordre fra eBoks"
},
"soBillingAddress": {
"value": {
"overrideAddress": {
"value": true
},
"addressLine3": {
"value": "0"
}
}
},
"lines": [
{
"operation": "Insert",
"alternateID": {
"value": "6796"
},
"subaccount": [],
"externalLink": " ",
"inventoryNumber": {
"value": "1"
},
"uom": {
"value": "STK"
},
"quantity": {
"value": 1.0
},
"note": {
"value": "6796 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
}
},
{
"operation": "Insert",
"alternateID": {
"value": "11252"
},
"subaccount": [],
"externalLink": " ",
"inventoryNumber": {
"value": "122"
},
"uom": {
"value": "STK"
},
"quantity": {
"value": 2.44
},
"note": {
"value": "11251 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
}
}
]
}
It appears that the error might be related to one of the inventories ("inventoryNumber") used in the JSON. Please make sure none of them have a status other than "Active" in the Financials ERP UI. (Stock Items:ScreenId=IN202500) & (Non-stock Items:ScreenId=IN202000)
yes, key and value is set from the integration and connector to api.
there is non items that contains other statuses than active.
Any other suggestions?
Please try creating the sales order in the Financials ERP UI with the same values / inventory in the lines sent via the API to see if the system highlights any error that can help to find out the issue.
Please also inform us about the details of your custom order type (EB) by sending print screens from Order Types panel (ScreenId=SO201000) in the Financials ERP UI
Example:
Including, General Information & Template settings tab for "EB"
Thanks.
Hi,
creating orders UI is not a problem. I've made an example from our json, see below.
There is also a screenshot of the ordertype EB.
We can add the complete json from our rapper on monday.
Hello,
have you saved the Order after entering the data in the UI ? Also, it seems all the lines set "0" quantity and without unitPrice / cost, could you adjust that according to what is sent in the JSON and retry ?
Hello,
when you're posting an API issue on the community, please share clarified information which belongs to your API Transaction/s.
Hi, sorry for lack of information.
We are using the endpoint: POST /controller/api/v2/salesorder
Here is an example of our json throught post, and error message below:
Response code 500 - internal servererror
{
"soBillingAddress": { "addressLine3": "0" },
"lines": [
{
"alternateID": "6796",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 8.0,
"note": "6796 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.14,
"unitCost": 0.14,
"note": "6796 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11251",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 1.0,
"note": "11251 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.01,
"unitCost": 0.01,
"note": "11251 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11219",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 1.0,
"note": "11219 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.04,
"unitCost": 0.04,
"note": "11219 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "155940",
"subaccount": [],
"externalLink": "00001481",
"operation": "Insert",
"inventoryNumber": "1006006",
"uom": "stk",
"quantity": 3858.0,
"note": "155940 | Region Sj�lland eNotify | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": "00001481",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.0,
"unitCost": 0.55,
"note": "155940 | Region Sj�lland eNotify | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "147162",
"subaccount": [],
"externalLink": "00003908",
"operation": "Insert",
"inventoryNumber": "1002002",
"uom": "stk",
"quantity": 22417.0,
"note": "147162 | KMD | 5798002040708 | Plads betales for: 124 MB | Plads total: 124 MB"
},
{
"subaccount": [],
"externalLink": "00003908",
"operation": "Insert",
"inventoryNumber": "1003014",
"uom": "stk",
"quantity": 124.04,
"unitCost": 124.04,
"note": "147162 | KMD | 5798002040708 | Plads betales for: 124 MB | Plads total: 124 MB"
},
{
"alternateID": "1649",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 59.0,
"note": "1649 | | 5798002040708 | Plads betales for: 009 MB | Plads total: 009 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 9.40,
"unitCost": 9.40,
"note": "1649 | | 5798002040708 | Plads betales for: 009 MB | Plads total: 009 MB"
},
{
"alternateID": "179355",
"subaccount": [],
"externalLink": "00003361",
"operation": "Insert",
"inventoryNumber": "1002002",
"uom": "stk",
"quantity": 11800.0,
"note": "179355 | Str�lfors Connect | 5798002040708 | Plads betales for: 749 MB | Plads total: 749 MB"
},
{
"subaccount": [],
"externalLink": "00003361",
"operation": "Insert",
"inventoryNumber": "1003014",
"uom": "stk",
"quantity": 749.34,
"unitCost": 749.34,
"note": "179355 | Str�lfors Connect | 5798002040708 | Plads betales for: 749 MB | Plads total: 749 MB"
},
{
"alternateID": "11180",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 1.0,
"note": "11180 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.06,
"unitCost": 0.06,
"note": "11180 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "8805",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 9.0,
"note": "8805 | | 5798002040708 | Plads betales for: 001 MB | Plads total: 001 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 1.44,
"unitCost": 1.44,
"note": "8805 | | 5798002040708 | Plads betales for: 001 MB | Plads total: 001 MB"
},
{
"alternateID": "171645",
"subaccount": [],
"externalLink": "00003908",
"operation": "Insert",
"inventoryNumber": "1002002",
"uom": "stk",
"quantity": 12752.0,
"note": "171645 | KMD | 5798002040708 | Plads betales for: 536 MB | Plads total: 536 MB"
},
{
"subaccount": [],
"externalLink": "00003908",
"operation": "Insert",
"inventoryNumber": "1003014",
"uom": "stk",
"quantity": 536.99,
"unitCost": 536.99,
"note": "171645 | KMD | 5798002040708 | Plads betales for: 536 MB | Plads total: 536 MB"
},
{
"alternateID": "11239",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 2.0,
"note": "11239 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.08,
"unitCost": 0.08,
"note": "11239 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11178",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 3.0,
"note": "11178 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.14,
"unitCost": 0.14,
"note": "11178 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "147164",
"subaccount": [],
"externalLink": "00003908",
"operation": "Insert",
"inventoryNumber": "1002002",
"uom": "stk",
"quantity": 17786.0,
"note": "147164 | KMD | 5798002040708 | Plads betales for: 105 MB | Plads total: 105 MB"
},
{
"subaccount": [],
"externalLink": "00003908",
"operation": "Insert",
"inventoryNumber": "1003014",
"uom": "stk",
"quantity": 105.04,
"unitCost": 105.04,
"note": "147164 | KMD | 5798002040708 | Plads betales for: 105 MB | Plads total: 105 MB"
},
{
"alternateID": "9753",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 4.0,
"note": "9753 | | 5798002040708 | Plads betales for: 006 MB | Plads total: 008 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 6.13,
"unitCost": 8.19,
"note": "9753 | | 5798002040708 | Plads betales for: 006 MB | Plads total: 008 MB"
},
{
"alternateID": "147161",
"subaccount": [],
"externalLink": "00003908",
"operation": "Insert",
"inventoryNumber": "1002002",
"uom": "stk",
"quantity": 25513.0,
"note": "147161 | KMD | 5798002040708 | Plads betales for: 218 MB | Plads total: 218 MB"
},
{
"subaccount": [],
"externalLink": "00003908",
"operation": "Insert",
"inventoryNumber": "1003014",
"uom": "stk",
"quantity": 218.63,
"unitCost": 218.63,
"note": "147161 | KMD | 5798002040708 | Plads betales for: 218 MB | Plads total: 218 MB"
},
{
"alternateID": "11049",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 1.0,
"note": "11049 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.05,
"unitCost": 0.05,
"note": "11049 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11216",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 1.0,
"note": "11216 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.04,
"unitCost": 0.04,
"note": "11216 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11185",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 3.0,
"note": "11185 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.42,
"unitCost": 0.42,
"note": "11185 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11226",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 17.0,
"note": "11226 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.74,
"unitCost": 0.74,
"note": "11226 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11211",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 2.0,
"note": "11211 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.08,
"unitCost": 0.08,
"note": "11211 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11173",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 2.0,
"note": "11173 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.08,
"unitCost": 0.08,
"note": "11173 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11177",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 1.0,
"note": "11177 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.03,
"unitCost": 0.03,
"note": "11177 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11205",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 1.0,
"note": "11205 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.04,
"unitCost": 0.04,
"note": "11205 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11175",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 7.0,
"note": "11175 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.23,
"unitCost": 0.23,
"note": "11175 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11208",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 4.0,
"note": "11208 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 0.16,
"unitCost": 0.16,
"note": "11208 | | 5798002040708 | Plads betales for: 000 MB | Plads total: 000 MB"
},
{
"alternateID": "11221",
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1002101",
"uom": "stk",
"quantity": 11.0,
"note": "11221 | | 5798002040708 | Plads betales for: 002 MB | Plads total: 002 MB"
},
{
"subaccount": [],
"externalLink": " ",
"operation": "Insert",
"inventoryNumber": "1003011",
"uom": "stk",
"quantity": 2.44,
"unitCost": 2.44,
"note": "11221 | | 5798002040708 | Plads betales for: 002 MB | Plads total: 002 MB"
}
],
"orderType": "EB",
"hold": true,
"date": "2021-08-01T00:00:00",
"requestOn": "2021-08-31T00:00:00",
"customer": "85",
"description": "Inngående ordre fra eBoks"
}
"Response": Error creating salesOrder. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> PX.Data.PXForeignRecordDeletedException: Error: The record has been deleted.
at PX.Data.PXSelectorAttribute.SubstituteKeyFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e)
at PX.Data.PXDimensionSelectorAttribute.FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e)
at PX.Objects.IN.CrossItemAttribute.FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e) in D:\Data\BuildAgent\work\11023e52ea15d342\Web\Pure\PX.Objects\IN\Descriptor\Attribute.cs:line 8157
at PX.Data.PXCache.OnFieldUpdating(String name, Object row, Object& newValue)
at PX.Data.PXCache`1.SetValueExt(Object data, String fieldName, Object value)
--- End of inner exception stack trace ---
at Visma.net.ERP.Api.Base.BaseDomain.HandleChildCommand(IBaseCommand cmd, Boolean handleChildCommands) in D:\Data\BuildAgent\work\11023e52ea15d342\Web\Lib\Visma.net.ERP.Api\Base\BaseDomain.cs:line 72
at Visma.net.ERP.Api.Base.BaseDomain.ApplyChildCommands(IEnumerable`1 childCommands, Boolean handleChildCommands) in D:\Data\BuildAgent\work\11023e52ea15d342\Web\Lib\Visma.net.ERP.Api\Base\BaseDomain.cs:line 44
at Visma.net.ERP.Api.SO.CommandModel.SoCommandHandler.Handle_V2(ICreateSalesOrderCommand[] cmdList) in D:\Data\BuildAgent\work\11023e52ea15d342\Web\Lib\Visma.net.ERP.Api\SO\CommandModel\SoCommandHandler.cs:line 83
at Visma.net.ERP.Web.Api.Repositories.SOOrderWebRepository.CreateSaleOrderReturnSaleOrderNumber(SalesOrderUpdateDto salesOrderUpdateDto, String orderType, Int32 version) in D:\Data\BuildAgent\work\11023e52ea15d342\Web\Lib\Visma.net.ERP.Web.Api\Repositories\SOOrderWebRepository.cs:line 178
Error: The record has been deleted.
What type of order is your "EB" order?
Have you tried entering in the UI?
Hi,
We'll have a look and get back to you.
Copyright © 2022 Visma.com. All rights reserved.