Skip to content

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

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

AcumaticaLookup( systemid, entity, filter, returnPath, mustreturnvalue )

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 as OrderNbr/value.
  • 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 OrderNbr of the SalesOrder whose ExternalRef is equal to the value of the id field:

AcumaticaLookup("ACUMATICA", "SalesOrder", "ExternalRef eq '" & %id & "'", "OrderNbr/value", False)

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 as InventoryID='AALEGO500'.
  • returnField
    • The field to return, such as SiteID. The function reads the field's value. Name the field alone, without /value.
  • 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 %Warehouse field.
  • "InventoryID='" & %itemCode & "'"
    • The filter applied to the response of the Generic Inquiry. It keeps the records whose InventoryID is equal to the %itemCode field.
    • With the inquiry parameter, it limits the returned value to a record where the warehouse is %Warehouse and the InventoryID is %itemCode.
  • "SiteID"
    • Returns the SiteID field.
  • False
    • Returns an empty string when no record matches, and raises no error.