Support Article
closeAllDocuments and closeCurrentWorkItem APIS not working
Summary
Following APIs are not working according to the description provided in the pega_desktop_api.
pega.desktop.closeAllDocuments --This function will close all closeable dynamic container documents - in both tabbed and tabless modes
pega.desktop.closeCurrentWorkItem-Closes the current work item without changing the focus of the space.
User added the below java script functions to UserWorkForm fragment and called the same through Run Script action .
function closeDocuments(event){
alert("##START - Close All Documements");
pega.desktop.closeAllDocuments(event);
alert("##END - Close All Documements");
};
function closeDocument(){
alert("##START - Close Current Documement");
pega.desktop.closeCurrentWorkItem();
alert("##END - Close Current Documement");
};
Error Messages
No error message.
Steps to Reproduce
1) Copy and paste the "closeDocuments" and "closeDocument" methods in user work form.
2) Configure a button('close docs') with onclick event - RunScript action to call the above methods.
3) Launch the portal and open some work items click on button 'close docs'.
Root Cause
A software use or operation error.
User is calling a script api method "pega.desktop.closeAllDocuments(event);" in a different context. The purpose of the method and the user requirement is not same.
Resolution
Following is the example where the API must be used:
1) Go to Access group configuration and Add "pyCaseManager" portal. This is a Pega 6.x Case Manager Portal.
2) Open Section "Work-pyCaseHeader" and do the private edit of the section.
3) Add a Button "Close all Documents" and configure onclick event, RunScript action to call "closeAllDocuments" script method by passing an event as parameter.
4) Open "Data-Portal.pyCaseMgrWATab" section to see how DynamicContainer is configured.
5) Launch the portal and open some of the work items and click on "Close all Documents" to close the work items as well as threads in the clip board.
Published January 31, 2016 - 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.