Support Article
Open child Work Objects in separate Pega thread in IAC
SA-9639
Summary
As part of the IAC implementation, User has to display work object (Review/Perform modes) in a div on a portal. From the perform mode, user can navigate to the child workobjects, which is rendered in a pop up. Until now the IAC invocation from the portal has not happened, so user has the HTML code from which IAC gadget was launched. During functionality testing when user takes an action on the child and upon returning to the parent, an error occurs when trying to take any action (call a flowaction) on the parent.
Error message:
Unable to display HTML for this action
Show Error
** Unhandled exception executing JSP: Index: 2, Size: 0
The above issue does not happen if the child is accessed from a parent opened in Review mode.
Resolution
Below solution is based on workarea control.
1. Host Application loads harness with simple workarea
2. PRPC loads WorkArea and when loaded, calls back to host application
3. Host application triggers load of work object
JS function in Host application that triggers load of work object is as below:
<script>
/*Handle the host providing what work object to open, no need to pass in as a parameter*/
var loadedWork = false;
function openWorkInPRPCWorkArea(){
if (!loadedWork) {
//caseID here should be dynamic.
setTimeout(function(){document.WorkCaseIfr.openWorkByHandle("PEGASAMPLE W-61", 1)}, 1000);
loadedWork=true;
}
}
</script>
Event listener in Pega application that calls JS that is in host application.
<script>
pega.util.Event.addListener(window,"load",openWorkObjectIAC);
function openWorkObjectIAC(){
var customAppWindow = null;
customAppWindow = pega.desktop.support.getDesktopWindow();
if (customAppWindow != null){
if (typeof customAppWindow.openWorkInPRPCWorkArea == 'function'){
customAppWindow.openWorkInPRPCWorkArea();
}
}
}
</script>
Published June 12, 2015 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.