We are getting "tstemp can not be empty" error when trying to update the production order items.
Production order is created and release and then trying to update the line items.
what could be the reason???
tsTemp error is displayed when the Record in the Dataview.Update is called where as that record does not exists in that DataView.
Related
I created a custom Import Scenario that uses the Employee screen. It essentially calls a custom Action I created. The action performs no redirection; it merely creates a new PREmployee record.
The configuration is below:
When I try to run this in an “Import by Scenario”, I receive an error: Error: x items have not been processed successfully. View name: Employee. No errors appear next to the individual items. Furthermore, the action performs as expected; the PREmployee record is created.
Why might this error be appearing and how might I troubleshoot?
Switch off the Commit on the SAVE action. Alternatively, tick the ignore error if all the information was added
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.
I have a SSP script that is attempting to create an invoice for an existing customer with a fee determined by what they applied for. I've set up the fee items under the noninventory items and I have a query which successfully gets the internal ID of the desired item. Next the script attempts to create an invoice and in doing so I am attempting to add the existing item using the internal ID that I have found. The problem is I can't get my head around how this relates, the schema browser shows a field called itemlist which is of type InvoiceItemlist which is made up of invoiceItems.
I take that to mean that I'm working with a sublist but there isn't an invoiceitem sublist type so I'm assuming I'm working with items. So, I've tried various ways to create a new sublist record but most of the examples I can find are how to create a new sublist record where as I just want to instantiate one of the existing items. I've included the snippet of code with my current attempt which isn't working.
var recNewInvoice = nlapiCreateRecord('invoice', {recordmode:'dynamic'});
recNewInvoice.setFieldValue('customform', '104');
recNewInvoice.setFieldValue('entity', stCustId);
// Add Item to invoice
_AddItem(recNewInvoice, stFeeId);
if (stDiscountId) {
_AddItem(recNewInvoice, stDiscountId);
}
try {
objDataResponse.Invoice.Id = nlapiSubmitRecord(recNewInvoice, true, true);
}
catch (ex) {
throw nlapiCreateError('WRITE_FAILED','nlapiSubmitRecord for invoice failed.' + ex.message);
}
// further down I define the function
function _AddItem(recInvoice, ItemID){
recInvoice.selectNewLineItem('item');
recInvoice.setCurrentLineItemValue('item','item',ItemID);
recInvoice.setCurrentLineItemValue('item','quantity',1);
recInvoice.commitLineItem('item', false);
};
I'm using a function for _AddItem because I'm may be adding a discount as well as the fee and I believe they are handled the same. When I run the code with a test case that returns a valid stFeeId I get the following error in the SSP execution log:
nlapiSubmitRecord for invoice failed.Please choose an item to add
*edit added error
*edit: I've updated the code portion to show the changes I've made based on different resources I've found. The original error isn't being generated but I'm getting this new error:
nlapiSubmitRecord for invoice failed.Items you have requested in the record have been deleted since you retrieved the form
When facing a problem like this one, what I generally do is try to create the same record I'm trying to create using the script with the exact same values and by setting the fields exactly in the same order of the scripts.
I do this because, like in your case here, the order is crucial : when creating an invoice, setting the entity will impact what you can use in the other fields, including the Items : so if it is possible that you are trying to use Item1 with an EntityX and Item1 can't be chosen for that EntityX, so the item field will remain empty and you will get that error.
So try creating the Invoice from the UI and see if you can select your item after selecting your entity: if not, then you must fix your configuration, and once you are able to fully create your invoice from UI, you will be able to do so from Script.
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.
I am having the following inconvenient when inserting a
custom field on a DAC extension, with Acumatica 17.202.0016 and
18.103.0022 version. In both versions I followed the next steps:
1) Created a "Usr" field "UsrCustomString", on the Opportunities page
CR304000, followed by creating its controls and publishing
the customization project.
Creation of "UsrCustomString" field
2) Then I selected an existing Opportunity and assigned a value in the new field.
Updating record with new value
Checking in DB the updated value
After doing this, I noticed that after navigating
to the next record and then selecting back the
OpportunityID "OP000368", the custom field shows blank. The same happens after pressing the cancel button.
Field is shown blank
I tried this sequence in the Cases page "CR306000" and it worked
correctly. It seems an issue related to the CROpportunity DAC.
Definition of the DAC extension with "CustomString" value
The solution that #cbetabeta, worked well for me. Here is the link for the solution
Custom field on CROpportunity doesn't display saved value since upgrading from 6.10 or 2017R2 to 2018R1