Support Article
Pega.desktop.showHarness API does not work
Summary
The Pega.desktop.showHarness API function displays a harness in a new tab of the work area gadget using the parameters passed.
The below JavaScript function is added to the custom functions which are written to a custom JavaScript file created for a button.
function handle_terminateOB(terminationCode, away, wrapUpPCN)
{
…
…
…
pega.d.showHarness("CloseCase", "Data-Portal","pyDashboard7", "", "", "", "No", "", "Yes","Yes", "_blank", "", "");
}
This custom function is invoked through a Run Script action. Therefore, even when the tabName is the same (that is, CloseCase), the Pega application creates a new thread with the same name when the function is invoked each time instead of using the existing thread.
Error Messages
Not Applicable
Steps to Reproduce
- Create a custom script.
- Add a function to invoke the pega.desktop.showHarness API with the respective parameters.
- Configure a button with an onClick event - RunScript action to invoke the above custom method.
- Launch the portal.
- Navigate to the section in which the button is configured.
- Click the button to trigger the method.
Root Cause
A software use or operation error.
The API is intended to work from a document; however, the API is invoked from the parent document.
Resolution
Perform the following local-change:
Invoke the pega.desktop.showHarness API from the parent document.
var modules = document.querySelectorAll("#moduleGroupDiv div.iframe-wrapper");
var activeModule = null;
for(var count=0;count<modules.length;count++){
if(modules[count].style.display=="block"){
activeModule = modules[count].querySelector(".dynamicContainer");
}
}
if(activeModule!=null){
var activeGadget = activeModule.getAttribute("pegagadget");
pega.ui.WorkAreaGadget.onGadgetClose(activeGadget);
}
Published October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.