Refer datapage with parameters in HTML rule

Refer datapage with parameters in HTML rule

Using pega:reference tag

We might have come across or probably used pega: reference jsp tag to refer properties in HTML rules like Fragment, Correspondence, Paragraph etc.

There could be a scenario where we have to refer a parameterized Datapage in a HTML rule. But the syntax to access or refer a Datapage with parameters doesn't work.

D_PageName[param1: value1, param2: value2].PropertyName

However, there is a workaround to refer properties from parameterized Datapages.

Note: It is not recommended to use this method. Better way is to construct a new Datapage or a normal page with all values and use as reference in HTML rule.

By setting the required parameters using java scriplet prior to using a reference tag, system will load the Datapage and the properties will be constructed in HTML rule.

Screenshot of code snippet in HTML

<!-- Sample snippet to refer parameterized Datapages -->

<%
   // Set all parameters required for datapage
  tools.putParamValue("OperatorId", "administrator@pega.com");
 // Set all other params required for datapage
%>
    <div>
        <h1>Referencing Parameterized Data Page in HTML Rule</h1>
        <div>
            Name: <pega:reference name="D_pxOperatorDetails.pyUserName" />
        </div>
      <div>
            Email: <pega:reference name="D_pxOperatorDetails.pyAddresses(Email).pyEmailAddress" />
        </div>
      <div>
            TimeZone: <pega:reference name="D_pxOperatorDetails.pyDefaultTimeZone" />
        </div>
    </div>

And the result looks like this

End result of Datapage with params in HTML

Hope this helps and be very careful to refer properties from parameterized Datapage using this method. This is not supported and there is no official documentation.

If there any questions, feel free to reach me.

Cheers!

Did you find this article valuable?

Support Krishna Nidri by becoming a sponsor. Any amount is appreciated!