Criteria Objects

Administration

The criteria object is available when invoking a REST call on a resource action. Administrators can provide criteria parameters in the request body to retrieve specific content and limit the size of the response.

Criteria Query Definition Parameters

Parameter Description

actions

An array of action names, whose state is requested in the state object response.

Example

"actions": ["save","print"]

childDefs

 

An array of child query definitions that specifies query requests for child resources.

  • name - The alias name of the child resource for this query
  • recursive - This Boolean parameter specifies whether the child resource is recursively expanded.
  • queryDef - A query definition object for the child resource.

Example

"childDefs": [
   {
      "name":"transactionLines",
      "recursive":false,
      "queryDef": {
         "state" true,
         "fields":["lineField1","lineField2]
      }
   }
] 

childGroups

This parameter is used to group Transaction Lines based on a Boolean value and menu options. It consists of the following properties:

  • attributeName - The name of the attribute to group by (String).

  • groupOffset - The starting point or offset for the group (Integer).

    Default value: 0

  • groupLimit - The limit on the number of items to show in the group (Integer).

    Default value: 25

  • expandGroups - A Boolean indicating whether to expand all groups. If false, only the first group will show items.

Example:

"childGroups": {"attributeName": "status_l", "groupOffset": 10, "groupLimit": 5, "expandGroups": true}

Restrictions:

  • childGroups and rootFields can only be used in Commerce.

  • childGroups and rootFields cannot be used together with "enableHierarchy": true.

enableHierarchy

This Boolean parameter is used to enable hierarchical search and sort behaviors.

  • true – hierarchical search and sort behaviors are enabled.

  • false – standard search and sort behaviors are used. Default value is false.

excludeFieldTypes

This parameter allows exclusion of specified attribute types from the response.

ClosedView valid field types:

excludeFieldTypes and fields parameters cannot be used together in the same request body.

Example

"excludeFieldTypes": ["customerId","sequenceNumber"]

expand

An array of child resource names that you want to expand so that the contents return with the parent in the same request.

When expand and childef parameters are both used for the same child resource, the childDef parameter takes precedence.

"expand": ["transactionLines","accounts"]

expandedDomainCriteria

A map of dynamic menu field names, whose expanded domains are requested in the state object response, to a map of criteria, which are meant for filtering dynamic menu options. The criteria map should contain the node(s) information when dynamic menus on LIG are expanded. The criteria map also contains the search string. The search strings support contains, and are case-insensitive.

expandedDomains

An array of field names that returns expanded domains in the state object response. The field's domain object will be expanded to include an availableElements array.

Example

"expandedDomains": ["menuAttr1","menuAttr2"]

expandNodes

This Boolean parameter is used to expand nodes and is only be available when enableHierarchy is true.

  • true All nodes will be expanded

  • false All nodes will be collapsed. Default value is true.

fields

An array of field names to be returned. The fields array values determine the "attributes" in the response's state object.

Example

"fields": ["field1","field2"]

groups

An array of group names, whose state is requested in the state object response.
For example: group can correspond to UI tabs, and return the aggregated state information for all fields contained within the UI tab.

Example

"groups": ["tab_123","tab_234"]

layoutRules

This parameter specifies the state of layout rules which need to be fetched and executed.

By default, this value is set to NO_RULE indicating that layout rules is not executed. Allowed values: DEPLOYED, UNDEPLOYED, NO_RULE

limit

A positive integer value that specifies the maximum number of items returned by the server.

nodesExceptionList:

An array of document numbers recording the nodes that violate current expandNodes flag

orderby

An array of field names to specify the order of items returned in the response, each field name could optionally be followed by asc or desc. The default is "asc".

Example

"orderby": ["listPrice:asc","totalPrice:desc"]

parentNodes

An array of field names to include in the parentFields of each resource row.

q

This string declares a query specification expression in MongoDB format.

"q": "{'_part_number':{$eq:'part100'}}"

rootFields

An array used to display specific fields of the root element for each row in the response, typically inside the _state attribute. Each item in this array corresponds to an attribute that is shown.

Example:

"rootFields": ["_part_number"]

Restrictions:

  • childGroups and rootFields can only be used in Commerce.

  • childGroups and rootFields cannot be used together with "enableHierarchy": true.

state

This Boolean parameter specifies whether to include the state property.
By default, this value is set to false and the state property is not included.

Example

"state": false

totalResults

This Boolean parameter specifies whether to calculate the totalResults property.
By default, the value is set to false indicating that totalResults is not calculated.

Example

"totalResults": false

Error Criteria Object

This object can be used to request an error response if errors occur when opening a Transaction Line. The "errorCriteria" and its definition are the same as "criteria" parameter, except that the "errorCriteria" parameter is for current resource rather than destination resource.

Note: The "errorCriteria" parameter can only be used in REST services requests for Open Transaction, Open Transaction Line, and Back actions.

ClosedRequest Sample

"cacheInstanceId":"-1",
  "documents":{
     "quoteText": "abc"
  },
  "criteria":{
    "fields":["lineFloat"],
      "state" true
  },
  "errorCriteria":{
    "fields":["quoteText"],
      "state": true
  },
  "selections":["TransactionLine/2"]
}

ClosedResponse Samples

Response Sample without Error

"documents: {
  "lineFloat": 123,
  "_state": { 
    "attributes": { 
      "lineFloat": { 
        "updatable": true,
        "hasError": false,
        "visible": true, 
        "hasConstraintViolation": false 
      }   
    }
  }
}

Response Sample with Error

"documents": {
  "quoteText": null,
  "_state": {
    "updatable": true,
    "hasError": true,
    "messages": ["Could not perform Action: Open - TransactionLine QuoteText is required."],
    "attributes": {
      "quoteText": {
        "updatable": true,
        "hasError": true,
        "messages": ["QuoteText is required."],
        "visible": true,
        "hasConstraintViolation": true
      }
    }
  }
}

Notes

Note: When creating parameter query to filter results, attributes that are also data columns should be used.

Related Topics

Related Topics Link IconSee Also