How to get all contacts through the Acumatica REST API - acumatica

I know the normal way to get all records of an entity is
http://localhost/AcumaticaERP/entity/Default/17.200.001/"entity"
However, when I use this method to return the Contact entity I receive an error.
"exceptionMessage": Optimization cannot be performed.The following fields cause the error:
AddressValidated: View AddressCurrent has BQL delegate
ExceptionType: PX.Api.ContractBased.OptimizedExport.CannotOptimizeException
I have tried adding parameters such as filtering by last modified date this still did not work. I know that you can get a single contact by providing the ID but this is not what I want. I want to return a list.

Related

Acumatica REST API - StockItem - how to use multiple product id in request

I am using the Acumatica REST endpoint https://companyName/AcumaticaERP/entity/Default/6.00.001 in my application
I am using the URL https://companyName/AcumaticaERP/entity/Default/6.00.001/StockItem?$filter=InventoryID eq '123456'&$expand=WarehouseDetails to fetch info about a Product and to get complete warehouse details
My query is how to use multiple product id's in single request, so that to get info about multiple products in single request to Acumatica Erp REST Url.
You can either use a generic GET request in order to have a list of all the records in that entity, you can append a specific ID at the end to select a single entity or you can use filters in order to restrict that list.
you might want to take a look at the following article from the Acumatica Help section:
Parameters for Retrieving Records :
https://help-2018r2.acumatica.com/(W(3))/Help?ScreenId=ShowWiki&pageid=c5e2f36a-0971-4b33-b127-3c3fe14106ff
but basically you will need to use different condition than "eq" in order to match more value. Even though there is no "in" condition

GET request $filter on field in a 'Detail' versus 'Top-Level'

I am developing a series of requests using Acumatica's REST API to be used in an Ecommerce integration. This particular example I wanted to get all items that had an onhand quantity.
/entity/Default/17.200.001>/PhysicalInventoryCount?$filter=PhysicalInventoryCountDetail/PhysicalQty gt 1
And received the following error:
"message": "An error has occurred.",
"exceptionMessage": "The given key was not present in the dictionary.",
Just to be sure I wasn't doing something wrong I went ahead and used the example shown in the acumatica help for the $filter parameter:
/entity/Default/17.200.001/Customer?$filter=MainContact/Email eq >'barkeep#usabartend.con'
And this in fact did bring up the correct customer record
'MainContact' is listed as a an object type 'Top-Level' of 'Customer' while 'PhysicalInventoryCountDetail' has an object type of 'Detail', is it simply that I cannot filter on a detail object field? Or is there something I am missing.
Thanks
You should not filter by details. It is not supported.
You can filter by linked entities (and it works in your example with filtering by contact email).

How to resolve relationship using Composer Query?

My assets:
Vehicle which contains an owner.
I want to list all vehicles along with its owner information using Query in queries.qry.
Using AssetRegistry I can get the results using resolveAll method, anyway how to get the same result using Query?
resolveAll isn't available in the Composer runtime at the time of writing (ie like it is in composer-client) so you can't get all resolved relationships invoking a Query (say in a TP) - see Issue
https://github.com/hyperledger/composer/issues/3454 . But you can get them via REST Filters ; adding {"include":"resolve"} as a filter, will resolve all the relationships to the asset owners and you can process the results that way.

how to fix "openerp.osv.expression: Field 'Sale Order' (sale_id) can not be searched: non-stored function field without fnct_search"

When I write the code of getting the tracking status
openerp.osv.expression: Field 'Sale Order' (sale_id) can not be
searched: non-stored function field without fnct_search
this error is caused.how to fix it?
From wizard when check mark is checked then call the method for tracking status.
You cannot search for fields that are not stored in the database. By default, the function fields do not get stored in the database.
You have two options here, you either use store=True to the definition of your field so that the field is indeed stored in the database and you can search on it or you can provide a fnct_search method that will perform the searching and return the result.

Net Suite Override internal id

Is this possible to set or override the internalid of a custom record type ?
The internalid is self generated, but I want to try to set inernalid value from a cvs field.
I do not believe you can override the internalid of any record instance, even a custom one. You can, however, use the externalid field that I believe every record has if you want to specify a "secondary" identifier for the record.
You cannot override the internal ID of a record. As mentioned in a previous response to your question, you can (and should) set the external ID field on the NetSuite records to equal the primary key of the data being imported.
On future imports that update NetSuite data, you simply map the key field of the imported data to the external ID field in NetSuite. You can ignore the internal ID field on those future imports, as Netsuite will match up the records based upon the external ID.
This is the proper way to do this - I've seen tons of situations where people did not understand the external ID concept, and created huge, long term maintenance issues by not following this simple solution.
OK. Given your feedback, why not create another custom field on the customer record that references the lookup value in the custom record?
The field type should be the same as the field type of the lookup value, with "store value" checkbox unchecked. On the Sourcing and Filtering tab, you specify the custom record type and field to reference. Think of it as a SQL join of sorts between the customer record and custom record.
Then, you should be able to do what you want with 2 getCurrentAttribute tags:
<%= getcurrentattribute('cusomter', 'custentity_mappingid')%>
<%= getcurrentattribute('cusomter', 'custentity_mappingvalue')%>
BTW, your custom field internal IDs look a little odd. They should start with 'custentity', and 'custrecord', respectively. My code above reflects what you'd normally expect from NetSuite.
You can set ExternalId and if you want to get record then you can use callGetRecordByExternalId .
public ReadResponse callGetRecordByExternalId(String externalId, RecordType recordType) throws RemoteException {
return this.callGetRecord(Utils.createRecordRefWithExternalId(externalId, recordType));
}

Resources