How to Determine the Field Name for Use in Groovy API Methods

:info:

Since version 14.1: Most names in the left column of the table below are also accepted directly as filter aliases, so manual translation is often unnecessary. This does not apply to every row — see the note below the table — and the right-hand column always works.

When performing a search using, for example, the api.find method:

Groovy
api.find("Q", 0, 100,"targetDate",["quoteType"])

it might happen that an error like this is thrown:

NewElement : ERROR(@1): org.hibernate.QueryException: could not resolve property: quoteType of: net.pricefx.domain.Quote [select _it.quoteType from net.pricefx.domain.Quote _it where _it.isDeleted!=:p1 order by _it.id asc NULLS FIRST]

It means that quoteType field has not been found.

The reason is that there is a difference between map representations of domain objects (what is returned by api.find()), and doing a search in the database (what are the actual columns/fields that are available to filter in api.find()). Therefore, quoteTypeUniqueName instead of quoteType must be used in the method.

To determine the field name that can be used in the Groovy method to search or filter fields, please refer to the following table:

Field name as used in the UI, or returned by api.find()

Field name in the database (use this name to search, or filter fields)

Table

quoteType

quoteTypeUniqueName

Q

supersededBy

supersededByUN

Q

prevRev

prevRevUN

Q

rootUniqueName

rootUN

Q

sellerName

seller.sellerName

RBA

rebateType

rebateTypeUN

PYR, RR

headerRebateType

headerRebateTypeUniqueName

RBA

customerGroup

customerGroup.customerFieldValue

Q

productGroup

productGroup.productFieldValue

CT, RR

nodeId

id

C

changeRequestId

changeRequest.id

DCRI

compensationHeaderType

compensationHeaderTypeUN

CO

compensationConditionType

compensationConditionTypeUN

COLI

contractTermType

contractTermTypeUniqueName

CTLI

Note: an alias only works when the left-hand name is not itself a database field of the searched table. In particular customerGroup and productGroup do not work as filters (they match the raw embedded field and typically return no rows) — always use customerGroup.customerFieldValue / productGroup.productFieldValue. On Simulations (SIM), basePricelistId / basePriceGridId throw an error; filter baseCO with the value "${pricelistId}.PL" (price grids: .PG) instead.

Filtering “typedId” with api.find/api.stream

typedId can be filtered directly with Filter.equal, Filter.notEqual and Filter.in, using String value(s) in the exact "<id>.<typeCode>" form — for example, Filter.equal("typedId", "1234.Q"). The filter is translated to a fast primary-key lookup on id. Other operators are not supported: Filter.isNull("typedId") throws an error, and Filter.like must not be used (the pattern is not validated and can silently match all rows). In results, typedId always keeps its suffix (for example, "1234.Q").