Activity Property- methods in pega

Most activities spend a lot of time reading and writing properties. Pega gives you a family of Property- methods for this, and knowing which one to pick is a common interview question.

The methods and what they do

MethodWhat it does
Property-SetSets the value of one or more properties on the step page
Property-Set-MessagesAttaches a message to a property or to the step page, either as literal text or a message rule key
Property-Map-DecisionTableRuns a decision table and stores the result in a property
Property-Map-DecisionTreeRuns a decision tree and stores the result in a property
Property-Map-ValueLooks up a one-dimensional map value and stores the result in a single value property
Property-Map-ValuePairThe same idea for a two-dimensional map value
Property-RemoveRemoves a property and its value from the step page. The property rule itself is not changed

Choosing the right one

  • Need to give a property a fixed or calculated value? Property-Set.
  • Need the result of a business rule table? Property-Map-DecisionTable or DecisionTree.
  • Need to show an error next to a field? Property-Set-Messages.
  • Need to clear a value from the clipboard page? Property-Remove.

A worked example

A loan activity calculates an interest tier:

  1. Property-Set: .Score = Param.CreditScore
  2. Property-Map-DecisionTable: run InterestTierTable and put the result in .Tier
  3. Property-Set-Messages: if .Tier is empty, add the message "No tier found for this score" to .Score
  4. Property-Remove: remove the temporary property .TempScore when done

Tips

  • Use a data transform for simple property setting where possible. It is easier to read than an activity.
  • Every Property- method works on the step page, so check that setting first. See our post on the step page.
  • Use decision rules instead of long chains of if-else steps. Business users can maintain them without touching the activity.

More in the Activity label.

No comments:

Post a Comment