Cast error with Acumatica import scenario - acumatica

I am using the SOAP API in Acumatica to import customers as it’s so much faster than the rest API when dealing with a lot of data. I’ve created a new field on BAccount which is a Boolean. This field is added to both the customer and supplier screen. I can import suppliers fine, but for customers I get an invalid cast error. The value being passed is True as a string, but that works with standard Boolean fields, fine on supplier with the same field, but customers it gives the cast error.

The issue was due to field updating event for the field. When i debugged it during the import the field value was set to true. It hits this event lots of times and occasionally it pushed the value from a different field, the customer name which isn’t a Boolean. I’ve never seen the field events get the wrong value before, but I refactored the customization so didn’t need to use the event value anymore

Related

How to get 'Bills and Adjustment' grid fields in an endpoint extension

I'm working with a client on obtaining Bills and Adjustments values through the Contract based web services. I understand that certain fields aren't available in the Default Endpoint, and have to be obtained through an extension.
I'm trying to add fields from the Bills and Adjustments' Applications tab, but I'm running into a warning that I don't understand. If I extend the Default endpoint for 'Bills' (call it 'BillExt'), and I try to add the Reference Number field from the 'Applications' tab/grid (or any other field from that grid) - I get the following warning (see screenshot below)...
Can someone explain what the issue is, and how I go about adding these fields from the 'Applictaions' tab/grid? I've added fields from the 'Approval Details' grid without this warning without a problem. Is this a warning I can disregard?
You are trying to add a field from another table/view that can return multiple rows for a single Bill.
The correct way to do this is by adding a separate collection on the object and map the view on that collection. e.g: Applications or Details collections here.
That collection will have the information for all records related to the header once you retrieve them using the ?$expand=Details on the query string request.

Acumatica API PO insert errors

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.

NetSuite SuiteScript 2.0 invalid_fld_value when setting sublist field value

I'm using the NetSuite Contracts Renewals module and trying to make a NetSuite User Event script (SuiteScript 2.0) that sets a custom field value on the Contract Item record based on the original sales order.
The script works fine when I edit/save the record manually but when I use the "Create Contract Item" button on the Contract record I get the following error:
INVALID_FLD_VALUE You have entered an Invalid Field Value 8.0 for the following field: custrecord_count
The field is definitely an Integer field and it makes no sense that it would work in one context but not the other. I even tried hardcoding a value but no dice.
Anyone have any ideas?
Here's an example to illustrate how I'm attempting to set the value:
var contractItemRecord = context.newRecord;
contractItemRecord.setValue({
fieldId: 'custrecord_count',
value: 8
});
SS2.0 is inconsistent in its type handling. Sometimes it works with the types as expected and sometimes it needs a string but does a poorer job of type coercion than SS1.0.
I'd try count.toString() or count.toFixed(0)

Sharepoint integrated SSRS report data driven subscription issue:report requires user defined or default value

We have been running a SSRS report subscription in share point integrated mode for last 6 months.It was fine. This report had cascaded parameters which is auto populated based on user's access.For data driven subscription the user name was passed and internally other 4 access level parameter which are each a multi select parameter get populated. From last few days subscription was not going out on schedule time and below error was displayed. Even if we pass only one user from the query who has all proper access we are still getting the same issue. Also the parameter name which is displayed having no default or user defined value get changed. we have checked most of the users and they have proper access i.e value derived for each of the cascaded parameters.
Error: This report requires a default or user-defined value for the report parameter 'XXX'. To run or subscribe to this report, you must provide a parameter value.
The cascading parameters are like below
AAA -> XXX->YYY->ZZZ
Earlier the error message said parameter 'YYY' was missing a value.
As users come and go and move positions you will inevitably run into issues with their access. What I would suggest is that for each cascading parameter, have a default value that gets selected when there are no actual values available. For example, the value could be "N/A". And the report should successfully run and return no rows. You could even add a No Rows Message to it.

CRM 2011 javascript onchange event not working for system field in another organisation

I have some javascript code attached to the accounts entity. This code sets the requirement level of the primary contact attribute based on the value of a custom option set field showing various account types. This was developed on one server, where it worked, and so the solution was imported into another organisation where it now doesnt work.
It seems to be only on this field as i have changed the code to look at another field and that works fine. The error it gives is that the "Object doesn't support this property or method". Also what is strange is that the field doesn't appear in the list under the entity within the solution despite it being a system field.
The code i'm using is:
Xrm.Page.getAttribute("primarycontactid").setRequiredLevel("required");
Can anyone help me figure out what it's doing?
Thanks
EDIT: Found that the code is actually making the field required despite the error, but it's not displaying the * next to it. Also if I make the field required in it's settings then it does the same thing

Resources