N52 BPA Functions - Loop

Overview

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

Functions

Search for related articles DoLoop
Description:
Builds a DoLoop statement that executes a single action or multiple actions.

Note: Multiple actions only availble in Enterprise Edition or higher

Signature:
DoLoop('iterationcount', 'action')

Example:
DoLoop(3,
    CreateRecord('account',
                         SetAttribute('name', 'Account:' + DoLoopIndex())
   )
)

Creates 3 account records.

The function DoLoopIndex() allows you to access an integer containing the current index number of the loop.

The function DoLoopTotal() allows you to access an integer containing the total number of loops.

Note that multiple actions are only allowed for the Enterprise Edition or greater. 
Search for related articles DoLoopIndex
Description:
This function allows you to access an integer containing the current index number of the loop.

Signature:
DoLoopIndex()

Example:
Use the search function to see examples.
Search for related articles DoLoopTotal
Description:
This function allows you to access an integer containing the total number of loops.

Signature:
DoLoopTotal()

Example:
Use the search function to see examples.
Search for related articles ForEachRecord
Description:
Iterates over a set of records and performs an action

Delete all contacts that start with the letter A.

Signature:
ForEachRecord('entitycollection', 'action1', 'action2')

Example:
ForEachRecord(
   FindRecordsFD('AllContactsStartingWithA' ),
    DeleteRecord('contact', CurrentRecord('contactid')
   )
)


The function RecordIndex() allows you to access an integer containing the current index number of the loop.

The function RecordTotal() allows you to access an integer containing the total number of loops.

The function CurrentRecord() allows you to access an the entity object of the current loop.
Search for related articles CurrentRecord
Description:
This function allows you to access a field within the current record loop.

Signature:
CurrentRecord('fieldname')

Example:
Use the search function to see examples.
Search for related articles RecordEntityName
Description:
Returns the entity logical name for the current record in the loop.

Signature:
RecordEntityName()

Example:
Use the search function to see examples.
Search for related articles RecordIndex
Description:
Allows you to access an integer containing the current index number of the loop.

Signature:
RecordIndex()

Example:
Use the search function to see examples.
Search for related articles RecordTotal
Description:
Allows you to access an integer containing the total number of loops.

Signature:
RecordTotal()

Example:
Use the search function to see examples.
Search for related articles LoopUntilTrue
Description:
Performs a loop which takes two parameters one being an action and the other being a condition which must evulate to true or false. If true the loop will exit

Signature:
LoopUntilTrue('action', 'exitcondition')

Example:
Use the search function to see examples.

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