Support Article
Work count in workbaskets for manager portal is not updating
SA-5800
Summary
Customer reported that when they connect as manager to the application, and go on Workbasket tab, the work count for each workbasket is wrong after switching manually (by drag and drop) some work item from either a user worklist or a workbasket to either another worklist or another workbasket.
When the user closes his session, and reopens it, the work count is updated and it remains correct.
This problem occurs using the native pyDashboard harness, on SECTION Data-Portal pyDashboardLeftWrapper
Error Messages
No error message, but work object count is not updating properly in dashboard.
Steps to Reproduce
1. Open work manager portal.
2. Transfer some workobjects from one workbasket to another using drag and drop option. Try to do it very fast.
3. Now click on target wokrbasket and observe the count besides source and targe workbaskets.workobject count is not updating properly.
Root Cause
The root cause of this problem is a defect in Pegasystems’ code/rules pyWorkUrgencyDraggableControl.
Resolution
This issue is resolved through the following local change:
- Save the pyWorkUrgencyDraggable to your application ruleset. It is available rule. Replace the code in this control with the code given here
<%
String theValue = tools.getActive().toString();
theValue = theValue.split("\\.")[0];
String clockIcon = "";
int temp = 0;
try {
temp = Integer.parseInt(theValue);
} catch( Exception e) {}
if( temp > 60 ) {
//clockIcon = "zprredclock";
clockIcon = "pydragHandleRedShiny";
}
else if( temp > 30 ) {
//clockIcon = "zpryellowclock";
clockIcon = "pydragHandleYellowShiny";
}
else {
//clockIcon = "zprblackclock";
clockIcon = "pydragHandleGreenShiny";
}
String pzinskey = tools.getStepPage().getProperty(".pzInsKey").toString();
String primaryPage = tools.getPrimaryPage().getReference();
String errorMsg = tools.getLocalizedTextForString(".pyCaption", "Unable to transfer assignment");
String transferMsg = tools.getLocalizedTextForString(".pyCaption", "Transfer this assignment...");
String transferToMsg = tools.getLocalizedTextForString(".pyCaption", "Transfer this assignment to");
%>
<pega:choose>
<pega:when test="pxRequestor.pyPegaDesignMode != 'true'">
<script type="text/javascript">
function pyParseOutErrorMessage(html) {
var i = html.indexOf("<td class=\"StatusHeader\">Message</td>");
if (i > -1) {
var lastHalf = html.substring(i+37, html.length);
var start = lastHalf.indexOf("<td>") + 4;
var end = lastHalf.indexOf("</td>");
var message = lastHalf.substring(start, end);
return message;
}
else {
return html;
}
}
function pyGetCountElement(tableNode) {
var tbody = pega.util.Dom.getChildren(tableNode);
var trs = pega.util.Dom.getChildren(tbody[0]);
var tds = pega.util.Dom.getChildren(trs[0]);
return tds[1];
}
function pyAdjustCountElement(node, diff) {
var num = node.innerHTML.substring(1,node.innerHTML.length-1);
var newCount = parseInt(num) + diff;
node.innerHTML = "(" + newCount + ")";
return newCount;
}
function pyGetUpdateCountParams(sourcePageName, sourceNewCount, targetPageName, targetNewCount) {
var url = new SafeURL();
url.put("SourcePageName",sourcePageName);
url.put("SourceNewCount", sourceNewCount);
url.put("TargetPageName", targetPageName);
url.put("TargetNewCount", targetNewCount);
return url.toQueryString();
}
(function() {
pega.util.Event.onDOMReady(function() {
var el = document.getElementById('<%=pzinskey%>');
/*var e2 = "$PpyDashboardTree$ppxResults$l1$ppxResults$l6";*/
var cell = el.parentNode.parentNode;
var dd = new pega.util.DDProxy(cell, "default", {
dragElId: "custom_<%=pzinskey%>",
resizeFrame: false,
isTarget: false
});
var pxy = document.getElementById("custom_<%=pzinskey%>");
pxy.innerHTML = "<%=transferMsg%>";
pxy.style.zIndex = "10000";
pxy.style.whiteSpace = "nowrap";
pxy.style.border = "1px solid #ccc";
pxy.style.padding = "4px 3px 0 30px";
pxy.style.background = "#efefef";
pxy.style.color = "#999";
pxy.style.width = "300px";
dd.onDragOver = function(e, id) {
var target = pega.util.Dom.get(id);
var theRow = target.parentNode.parentNode.parentNode;
pega.util.Dom.addClass(theRow, "selected");
pxy.innerHTML = "<%=transferToMsg%> <b> "+pega.util.Dom.get(id).getAttribute("data-name")+"</b>.";
};
dd.onDragOut = function(e, id) {
var target = pega.util.Dom.get(id);
var theRow = target.parentNode.parentNode.parentNode;
var theItem = target.parentNode.parentNode;
if (theItem.className.indexOf("selected") < 0) {
pega.util.Dom.removeClass(theRow, "selected");
}
pxy.innerHTML = "<%=transferMsg%>";
};
dd.onDragDrop = function(e, id) {
var target = pega.util.Dom.get(id);
var theParent = target.parentNode.parentNode.parentNode;
pega.util.Dom.removeClass(theParent, "selected");
var targetCount = pyGetCountElement(target);
var sourceId = "<%= pega_processengine_workutilities.pxPageNameClean(tools.getStepPage().getProperty(".pxAssignedOperatorID").toString()) %>";
var sourceCount = pyGetCountElement(document.getElementById(sourceId));
var newSourceCount = pyAdjustCountElement(sourceCount, -1);
var newTargetCount = pyAdjustCountElement(targetCount, 1);
var transferUrl = new SafeURL();
transferUrl.put("AssignmentID",el.id);
transferUrl.put("DestinationType", target.getAttribute('data-type'));
transferUrl.put("DestinationName", target.getAttribute('data-userId'));
transferUrl.put("Commit", true);
transferUrl.put("PrimaryPage", '<%=primaryPage%>');
transferUrl.put("UpdateHistory", true);
transferUrl.put("SourcePageName", '<%=primaryPage%>');
transferUrl.put("SourceCount", sourceCount.innerHTML.substring(1,sourceCount.innerHTML.length-1));
transferUrl.put("TargetPageName", target.getAttribute('data-ref'));
transferUrl.put("TargetCount", targetCount.innerHTML.substring(1,targetCount.innerHTML.length-1));
/*
pega.u.d.gBusyInd.busyIndInterval = 0;
pega.u.d.reloadSection(el,'TestActivityDrag',transferUrl.toQueryString(),false,false,'','',null,false);
*/
var sectionNode = pega.u.d.getSectionByName("pyAssignmentListWorkbasket", null, document);
if(sectionNode){
var sectionNodes = new Array();
sectionNodes[0] = sectionNode;
pega.u.d.gBusyInd.busyIndInterval = 0;
pega.u.d.reloadSections("",sectionNodes, 'TestActivityDrag',transferUrl.toQueryString(), null, null, null,null);
}
};
dd.endDrag = function(e, id) {
/*Cancel the drag so as not to actually move the dragged dom element.*/
return false;
};
});
})();
</script>
<div id="<%=pzinskey%>" style="padding-right:3px;cursor:move;"><img src="https://community.pega.com/templateimages/%3C%25%3DclockIcon%25%3E.png"/></div>
</pega:when>
<pega:otherwise>
<img src="https://community.pega.com/templateimages/%3C%25%3DclockIcon%25%3E.png"/>
</pega:otherwise>
</pega:choose>
- Create a new Non-Autogenerated section (uncheck Auto-generated HTML? Option in HTML tab ) and place the code given here
<%
ClipboardPage dragPage = tools.findPage("tempDragPage");
ClipboardPage dashBoardTree = tools.findPage("pyDashboardTree");
if(dragPage != null && dragPage.hasMessages())
{
dragPage.clearMessages();
dashBoardTree.clearMessages();
}
%>
- Save the Data-Admin-.pyAssignmentListWorkbasket section in your application rule set. It is available rule.
- Create a new activity with name ‘TestActivityDrag’ with 3 steps as mentioned here,




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.