Acumatica API PO insert errors - acumatica

I've been having many problems inserting a Purchase Order using the API because it often responds with errors which are vague or don't identify the cause correctly. We have quite a few customizations for the site involved, so to narrow down the issue, I created a new clean Acumatica ERP installation (v17.210.0034) to work with, with no endpoint extensions, and installed the SalesDemo data in both.
Even with clean installation sites like this, I'm still getting vague errors when trying to insert a PO. For example, I followed the steps below, using Postman to call the API:
Login: POST to url = "http://localhost/Acu172100034/entity/auth/login, with JSON credentials in the body. Response = success.
GET a PO: url = http://localhost/Acu172100034/entity/Default/17.200.001/PurchaseOrder/RO/PO000696?$expand=Details,ShippingInstructions. Response = JSON data for the PO
I copied the JSON in the GET response above and pasted it into a new PUT request body. I removed all "id", "rowNumber", "custom" and "files" fields. I removed the "OrderNbr" field in the header and detail rows since it is an auto-number field for a PO.
I attempt to insert a new PO using the modified JSON with a PUT: url = http://localhost/Acu172100034/entity/Default/17.200.001/PurchaseOrder,
The error response includes: "PX.Data.PXException: Error: 'Branch' cannot be empty.\r\nError: 'Ship To' cannot be empty.\r\nError: 'Location' cannot be found in the system.\r\n ---> PX.Data.PXOuterException: Error: Inserting 'Purchase Order' record raised at least one error. Please review the errors."
There is a BranchID specified on the PO Line, there is a Location specified on the PO header, and there is a ShipTo specified on the ShippingInstructions. The Location does exist. This error is obviously vague and misleading. Only by trial and error did I determine that I needed to change Hold from true to false to get past this error. I assume this is because there's some validation or rule which disallows an insert or update while on hold? After changing Hold to false and attempting an insert with a PUT again, I then get an error: "PX.Data.PXException: Error: An error occurred during processing of the field InventoryID: Object reference not set to an instance of an object.. ---> System.NullReferenceException: Object reference not set to an instance of an object." and the call stack includes POOrderEntry.POLine_ExpenseAcctID_FieldDefaulting and POOrderEntry.POLine_LineType_FieldUpdated event handlers.
There is an InventoryID on the PO Line, and the inventory item exists, so it looks like these event handlers are throwing errors for some reason when LineType is being set, but I'm guessing. Any ideas how to get this simple API insert to work?
Update (2/23/19): I modified the JSON for insert a bit more by changing the detail item Completed to "false", and the PO header Hold to "true", and the Status to "On Hold". The error mentioned above now changes to "Error: 'UOM' cannot be empty.\r\nError: 'Account' cannot be empty.\r\nError: 'Sub.' cannot be empty.". The UOM is not empty, Account is empty, and SubAccount is empty; but Account and SubAccount are not required fields for a PO Line.

After more trial and error, I was able to insert a PO by additionally changing the JSON being inserted by removing the two fields "QtyOnReceipts" and "ReceivedAmount". Can you see why the errors I'm receiving in the response in no way helps to find the cause of the error? I still don't even know why removing these fields resolved the error. The most reliable way to perform an API insert is probably -- as KRichardson suggested -- always insert first with only the minimum required fields, then perform an update with the rest. Or, perform a LOT of testing with trial and error to determine what fields and values allow for a successful insert. If I were to change or add field values in the JSON, or use JSON from a different record, I have no real confidence that the changes I made to get it to work will always work.

Related

How to handle required fields in Shopware 6 administration?

I'm trying to add validation in custom form in administration.
The required field has required property.
I've also added required flag in entity definition (with ->addFlags(new Required())), and when I save form with empty field, I've got an error from endpoint that says the field is required.
But I can't figure out how to show error message under this field.
For example when I'm creating new sales channel and save empty form, there are error messages under required fields.
How can I add this kind of error handling?
I think I've found it.
There is mapApiErrors function which maps api errors from global state to given entity and properties.

Unable to add Field in AX Table, Event viewer shows Object name exist

While adding fields, I am facing issue that I am not able to open my table if there is new field added. it shows error like this:
Whenever a field is added, it shows an error like this:
when I check the event viewer, it shows this error:
Full error code :
Can anyone help me with this issue?
It looks like SalesTable is not properly sync'd. This type of error usually just means you need to compile & sync the entire environment to get things "working" better.
Remove your custom fields, compile the table, right click on the table, and synchronize and verify first you can successfully synchronize the individual table. If you can sync it, then sync your entire data dictionary to ensure everything is sync'd up...if one table is off (in this way), it can mean there are other tables as well.
You can choose to try and add fields and see if it works, but I would just start with a full system compile & sync.
Note: Your infolog screenshots cut off the error message. When asking a question, make sure to include the actual error messages and redact personal information. Your event viewer screenshot is also cut off...same thing.
Identify that the ID in SQL is not match with the Table name at AOT .

Getting an error in docusign api explorer

I'm trying to populate the textTabs in one of the documents so that it has information prefilled into it using the call for EnvelopeTabs: update, however it keeps throwing me an error that it cannot find the tab that I am trying to test in the explorer. I have used the list call in the EnvelopeTabs to make sure that the information that I'm providing matches what is in the envelope and it is, here's an example of what I was seeing
enter image description here
enter image description here
When I make the call to update the tab in textTabs, I am doing it with the documentId, pageNumber, and tabLabel provided above and with the value set to what I want to be prefilled, however I keep getting an error that it cannot find the specified tab.
I have even tried filling it in with just the tabId and am still getting the same error.
In an effort to see if I was missing something, I also tried checking the linked reference documentation on the EnvelopeTabs: update page but it is 404ing (as were one or two other end points in the api explorer).
Any help would be appreciated as it seems like there is a piece of information that I'm missing to prefill tabs.
Are you creating the envelope via the API? If so, then the easy way to set a tab's value is to set the value parameter.
If you want to set a tab's value after the envelope is created, use the EnvelopeRecipientTabs: update method. (Note the resource name in your question was incorrect.)
When using this method, or any other DocuSign update method, remember that it is not a patch method: You must supply all of the parameters for the Envelope Recipient Tab that you're updating. If you don't already have all of the settings, then first do a get on the object, then update it.
I tried using below JSON call to update the Recipient tab and its updating the tab value:
PUT /restapi/v2/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs
{
"textTabs": [
{
"value":"newVal",
"tabId": "cef562dd-e098-4dcd-935d-34ff8f5b5211"
}
]
}

NetSuite: An error occurred while processing item options

I am loading, doing some changes, and saving a Sales Order. I do this on approve and everything works. I do this on edit (when the status is changed to Pending Approval) and it throws the above error:
"An error occurred while processing item options."
Now I have commented out the setting of 2 fields I was setting. It still throws the error.
The only thing that comes up in SuiteAnswers doesn't really make sense to this situation.
This ended up being caused by something else in my code that I didn't think mattered.
When status is changed to Pending Approval, I delete a record where there is a Custom field that references it on the SO line. I was deleting it, setting some values, and then saving the record. When i took the delete out, it worked. So I ended up pushing the id of the record to delete into an array and then looping over that AFTER I saved the record and it worked

The given key was not present in the dictionary. error when adding a SumCalc

I added a line user-defined field and a header user-defined field. However, when I attempt to total the line value on the header, I receive "The given key was not present in the dictionary" when accessing the screen. The screen is Sales Order Invoice (SO.30.10.00). Below is the code for the header and line fields.
It appears there is both a SO.SOInvoice and AR.ARRegister objects, my guess is that I need to provide a declaration somehow for the extension object for AR.ARRegister, but not sure how to do that.
Print Screen of DAC
I was able to resolve the issue. To resolve the issue, I un-published the project and cleared my cache. I then re-published the project and everything appears to be working correctly.

Resources