Follow these steps to add a Calculated Property for a ProcessMaker Screen:
View the Calculated Properties for that ProcessMaker Screen. The Calculated Properties screen displays all Calculated Properties configured for this ProcessMaker Screen. If no Calculated Properties have been configured for this ProcessMaker Screen, No Data Available displays.
Click the +Property button. The Calculated Properties screen displays settings to configure a Property.
In the Property Name setting, enter the name of the Calculated Property. This Calculated Property name displays both in the Calculated Properties screen and in the JSON data model when previewing the ProcessMaker Screen. This is a required setting.
In the Description setting, enter the description of the Calculated Property. This is a required setting.
Above the Formula setting, select one of the following ways to determine how the Calculated Property determines its value:
Mathematical calculation: Click the Formula iconto enter the value, mathematical calculation, or formula that calculates the Calculated Property. The Formula icon is selected by default.
return statement to return the result of an expression (the value). Furthermore, ensure to use the
Follow these guidelines to reference ProcessMaker Screen control or Magic Variable values:
Screen control value:
Reference a ProcessMaker Screen control's value by referencing that control's Variable Value setting. Example:
return this.FullName when
FullName is the Variable Value setting value for the control to reference its value when the Calculated Property runs.
Magic Variable value:
Reference a ProcessMaker Magic Variable's value. ProcessMaker uses a set of Magic Variables that become part of the JSON data model for all Requests. ProcessMaker uses these Magic Variables to store ProcessMaker user, Process, and Request related data for all Requests. During an in-progress Request, these ProcessMaker Magic Variables are updated. All ProcessMaker Magic Variables are preceded by an underscore (
_) character in the JSON data model. Reference the ProcessMaker Magic Variable after the
this. keyword. Example:
return this._user.fullname to reference the ProcessMaker user's full name from the in-progress Request. See Magic Variable Descriptions. Note that there is no ProcessMaker Magic Variable that stores the ProcessMaker user that starts a Request (known as the requester). To address this, use a Calculated Property to reference the
_user.fullname Magic Variable's value in the ProcessMaker Screen referenced in the first Task element of a Process; since many Processes are designed such that the requester is the ProcessMaker user assigned the first Task in a Request, this is a helpful way of storing who the requester is. This Calculated Property stores this Magic Variable's value, which you may reference elsewhere.
Click Save. The Property displays in the Calculated Properties screen. The following message displays: Property Saved.