Acumatica Lookups
The Acumatica connector adds two functions to IMan's scripting. Call them from any expression to look up or translate a value in any Acumatica instance.
- AcumaticaLookup queries an entity of the web services endpoint.
- AcumaticaInquiryLookup queries a Generic Inquiry.
AcumaticaLookup¶
Description
Queries any entity exposed to the web services endpoint and returns one field of the matching record. It works much like IMan's own Lookup function.
Syntax
Arguments
- systemid
- The ID of the System Connector to query.
- entity
- The name of the entity to return the field from, such as SalesOrder, PurchaseOrder or CustomerClass.
- filter
- The where clause of the query. See Filter Record for the syntax.
- returnPath
- The path of the field to return. Typically this is the field followed by
/value, such asOrderNbr/value.
- The path of the field to return. Typically this is the field followed by
- mustreturnvalue
- True or False.
- True: the function raises an error when the lookup returns no record.
- False: the function returns an empty string when the lookup returns no record.
AcumaticaInquiryLookup¶
Description
Queries any Generic Inquiry exposed to a web services endpoint and returns one field of the matching record.
The function takes two sets of filter fields and applies both:
- Inquiry
- The names and values the function passes to the parameters of the Generic Inquiry.
- Return
- A filter the function places on the records the Generic Inquiry returns.
Syntax
AcumaticaInquiryLookup( systemid, entity, expand, inquiryParameterFields, inquiryValues, returnFilter, returnField, mustreturnvalue )
Arguments
- systemid
- The ID of the System Connector to query.
- entity
- The name of the Generic Inquiry, such as StorageDetailsByLocationInquiry.
- expand
- The property in the response of the Generic Inquiry that holds its records, such as StorageDetailsByLocation.
- inquiryParameterFields
- One or more fields to pass to the parameters of the Generic Inquiry.
- Enclose several fields in an array, such as
Array("CustomerID", "ExternalRef"). - Pass an empty string
""for a Generic Inquiry without any conditions (not recommended).
- inquiryValues
- The values for the fields in the inquiryParameterFields argument.
- Enclose several values in an array, such as
Array(%customerId, %orderId). - Pass an empty string
""for a Generic Inquiry without any conditions.
- returnFilter
- The condition applied to the records the Generic Inquiry returns: a field compared with
=,<>,<,>,<=or>=, such asInventoryID='AALEGO500'.
- The condition applied to the records the Generic Inquiry returns: a field compared with
- returnField
- The field to return, such as SiteID. The function reads the field's value. Name the field alone, without
/value.
- The field to return, such as SiteID. The function reads the field's value. Name the field alone, without
- mustreturnvalue
- True or False.
- True: the function raises an error when the lookup returns no record.
- False: the function returns an empty string when the lookup returns no record.
Example
The SiteID of an item in a warehouse:
AcumaticaInquiryLookup("ACUMATICA", "StorageDetailsByLocationInquiry", "StorageDetailsByLocation", "WarehouseID", %Warehouse, "InventoryID='" & %itemCode & "'", "SiteID", False)
The arguments in turn:
"ACUMATICA"- Queries the Acumatica instance of the System Connector with the ID ACUMATICA.
"StorageDetailsByLocationInquiry"- Queries the StorageDetailsByLocationInquiry Generic Inquiry.
"StorageDetailsByLocation"- Reads the records from the StorageDetailsByLocation property of its response.
"WarehouseID"- The WarehouseID parameter of the Generic Inquiry.
%Warehouse- The value for the WarehouseID parameter. The example takes it from the
%Warehousefield.
- The value for the WarehouseID parameter. The example takes it from the
"InventoryID='" & %itemCode & "'"- The filter applied to the response of the Generic Inquiry. It keeps the records whose InventoryID is equal to the
%itemCodefield. - With the inquiry parameter, it limits the returned value to a record where the warehouse is
%Warehouseand the InventoryID is%itemCode.
- The filter applied to the response of the Generic Inquiry. It keeps the records whose InventoryID is equal to the
"SiteID"- Returns the SiteID field.
False- Returns an empty string when no record matches, and raises no error.