Support Article

Pega.desktop.showHarness API does not work

SA-62932

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

  1. Create a custom script.
  2. Add a function to invoke the pega.desktop.showHarness API with the respective parameters.
  3. Configure a button with an onClick event - RunScript action to invoke the above custom method.
  4. Launch the portal.
  5. Navigate to the section in which the button is configured.
  6. 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("#moduleGroupDivdiv.iframe-wrapper");
varactiveModule = null; 
for(var count=0;count<modules.length;count++){ 
if(modules[count].style.display=="block"){ 
activeModule = modules[count].querySelector(".dynamicContainer"); 


if(activeModule!=null){ 
varactiveGadget = activeModule.getAttribute("pegagadget"); 
pega.ui.WorkAreaGadget.onGadgetClose(activeGadget); 
}

Published August 10, 2018

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.