Loads and returns an array of entities of the specified entityname or an entity if unique=true or if a primary key id is passed in to filterCriteria.

entityLoad(entityName [, filterCriteria] [, unique])
entityLoad(entityName [, filterCriteria] [, sortOrder] [, options]) → returns array|object

Argument Reference for the entityLoad function


Required: Yes
Name of CFC / Entity


Required: No
A struct of key value pairs, or a primary key value


Required: No
When true a single entity is returned, otherwise an array


Required: No
Column name and direction list, eg: LastName ASC, FirstName ASC


Required: No
A struct with possible keys: ignorecase, sortorder, offset, maxresults, cacheable, cachename, timeout

Examples sample code invoking the entityLoad function

Load by PK

Loads an entity by primary key value

entityLoad("Employee", url.employee_id)

Expected Result: An Employee CFC Instance

Get multiple entities

Returns an array of Employee instances with last name Smith

entityLoad("Employee", {LastName="Smith"})

Expected Result: array

Fork me on GitHub