N52 BPA Functions - Find (EntityCollections)

Overview

The following are the currently supported Find functions within Business Process Activities (BPA).

Functions


Search for related articles FindRecords
Description:
Finds a collection of records. Defaults the recordcount to 50 and nolock to false.

Find a list of accounts with description set to North52.

Signature:
FindRecords('entitylogicalname', 'inputfieldname', 'inputfieldvalue', 'selectfields', 'recordcount', 'nolock')

Example:
FindRecords('account', 'description', 'north52', '*', '50', true)

Note you can use the following function to bring back limited fields SetFindSelect('name', 'description')
Search for related articles FindRecordsAudit
Description:
Generate an EntityCollection of the Audit Trail for a particular record. First example finds all audit records for last 7 days for a particular account. Second example finds the last edit record operation with no formatting.

Field names of the entity collection: 'Changed By', 'Date', 'Action', 'Attribute', 'Old Value', 'New Value'

Signature:
FindRecordsAudit('entityname', 'recordguid', 'lastnumberofdays', 'numberofedits', 'formattedvalues')

Example:
FindRecordsAudit('account', '10124ac3-0f6f-40dd-be64-d8c0bc5dbfbd', 7)

FindRecordsAudit('account', '10124ac3-0f6f-40dd-be64-d8c0bc5dbfbd', -1, 1, false)
Search for related articles FindRecordsFD
Description:
Finds a collection of records as defined by the fetchxml defined within a formula detail record.

Find a list of contacts with a parent company filtering by the city field of the current contact.

Signature:
FindRecordsFD('formuladetail', 'nolock', SetParams('param1', 'param2'))

Example:
FindRecordsFD('ContactsWithParents', true, SetParams([contact.address1_city]))
Search for related articles FindRecordsFetchXml
Description:
Finds a collection of records as defined by the raw fetchxml passed into the function

Signature:
FindRecordsFetchXml('fetchxml')

Example:
FindRecordsFetchXml('enter_your_raw_fetchxml_here')
Search for related articles FindRecordsValue
Description:
Finds a specific field value in an entity collection

Signature:
FindRecordsValue('entitycollection', 'fieldname', 'defaultvalue', 'rownumber' )

Example:
FindRecordsValue(GerVar('AccountListing'), 'description', 'Not Set', '0' )
Search for related articles FindECCount
Description:
Returns the count of rows in the entity collection

Signature:
FindECCount('entitycollection')

Example:
FindECCount(GerVar('AccountListing'))
 SubFunction 1: SetFindAnd()
The SetFindAnd() function can be used on the the following functions to build up the relevant where statement in the query.

-FindValue()
-FindSum()
-FindCount()
-FindMax()
-FindMin()
-FindAvg()


e.g. The function calls returns the sum of the values for the field 'numberofemployees' on the account entity where the category field equal 1 & the city field equals London.

FindRecords('account', SetFindAnd('category', 'address1_city'), SetFindAnd('1', 'London'), 'numberofemployees') 



 SubFunction 2: SetFindSelect()
The SetFindSelect() function can be used with the FindRecords()  & is used to limit the number of fields retrieved. This is for performance reasons.


e.g. This function call returns all the fields on the account entity into a record collection object. This is because the fourth parameter is a '*' 

FindRecords('account', 'description', 'north52', '*', '50', true)


e.g. This function call just returns the 'accountid' field on the account entity into a record collection.

FindRecords('account', 'description', 'north52', 'accountid', '50', true)


e.g. This function call uses the SetFindSelect() function to return the  'accountid', 'name' and 'description' fields on the account entity into a record collection object. 

FindRecords('account', 'description', 'north52', SetFindSelect('accountid', 'name', 'description'), '50', true)

See Also

Training Videos

View training videos for North52's Formula Manager

N52 Formula Manager

The world class business rules engine for Microsoft Dynamics CRM from North52.

Send comments about this topic to North52.
© 2013 North52. All rights reserved.

Feedback and Knowledge Base