Error occurs on getDataPage method JS API using event onload
I am trying to use JS getDataPage method using the onload event, but I'm facing the following error :
"Cannot read properties of undefined (reading 'ui')"
I tried to use the same approch sugested by another question:
"https://support.pega.com/question/error-getdatapage-method-js-api"
but its not working.
this is the script I'm using inside a section:
-----------------------------------------------------------------------------------------------
<script event="onload">
<%
ClipboardPage UIActionPage = ((PegaAPI) tools).getUIEngine().getUIActionPage("runActivity");
ClipboardPage actionAPI = UIActionPage.getPage("pyActionAPI");
actionAPI.putString("pyActivity", "pzGetDataPageJSON");
ClipboardPage activityParam = actionAPI.getProperty("pyActivityParams").getPageValue(ClipboardProperty.LIST_APPEND);
activityParam.putString("pyName", "pyDataPageName");
activityParam.putString("pyValue", "D_Criptografar");
((PegaAPI) tools).getUIEngine().getUIAction(UIActionPage).register();
UIActionPage.removeFromClipboard();
%>
I am trying to use JS getDataPage method using the onload event, but I'm facing the following error :
"Cannot read properties of undefined (reading 'ui')"
I tried to use the same approch sugested by another question:
"https://support.pega.com/question/error-getdatapage-method-js-api"
but its not working.
this is the script I'm using inside a section:
-----------------------------------------------------------------------------------------------
<script event="onload">
<%
ClipboardPage UIActionPage = ((PegaAPI) tools).getUIEngine().getUIActionPage("runActivity");
ClipboardPage actionAPI = UIActionPage.getPage("pyActionAPI");
actionAPI.putString("pyActivity", "pzGetDataPageJSON");
ClipboardPage activityParam = actionAPI.getProperty("pyActivityParams").getPageValue(ClipboardProperty.LIST_APPEND);
activityParam.putString("pyName", "pyDataPageName");
activityParam.putString("pyValue", "D_Criptografar");
((PegaAPI) tools).getUIEngine().getUIAction(UIActionPage).register();
UIActionPage.removeFromClipboard();
%>
var options = {
name: "D_Criptografar",
parameters: [{name: "numeroEstudo", value: "numeroEstudo", isProperty: false},
{name: "cdCgccpf", value: "cd_cgccpf", isProperty: false},
{name: "cdSite", value: "site", isProperty: false},
{name: "ctrl", value: "ctrl", isProperty: false}],
callback: callbackA,
};
pega.api.ui.actions.getDataPage(options);
function callbackA(RESULT) {
console.log(RESULT);
}
</script>
---------------------------------------------------------------------------------------------
Could somebody help me ? am I doing something wrong?