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
| Method | What it does |
|---|---|
| Property-Set | Sets the value of one or more properties on the step page |
| Property-Set-Messages | Attaches a message to a property or to the step page, either as literal text or a message rule key |
| Property-Map-DecisionTable | Runs a decision table and stores the result in a property |
| Property-Map-DecisionTree | Runs a decision tree and stores the result in a property |
| Property-Map-Value | Looks up a one-dimensional map value and stores the result in a single value property |
| Property-Map-ValuePair | The same idea for a two-dimensional map value |
| Property-Remove | Removes 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:
- Property-Set:
.Score=Param.CreditScore - Property-Map-DecisionTable: run
InterestTierTableand put the result in.Tier - Property-Set-Messages: if
.Tieris empty, add the message "No tier found for this score" to.Score - Property-Remove: remove the temporary property
.TempScorewhen 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