Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Add Task items are not visible

SA-26410

Summary



Tasks were added from interaction portal. However, not all intent tasks are visible on the screen.

Error Messages



Not Applicable

Steps to Reproduce

  1. Navigate to interaction screen.
  2.  Add multiple tasks.

Root Cause



This happens when five or six intent tasks are selected. The JavaScript (JS) function calls the createNewWork API on all cases at once. This initiates the process on the server to create five or six work objects. However, when Perform harness refreshes to display the launched work objects, not all work objects are processed. This is updated in the data page, which displays the list of current tasks. Thus, incorrect result is obtained in the interaction driver.

Resolution



Perform the following local-change:

When multiple tasks are selected, only one of them is launched. The rest are placed in a queued state. They are launched only when clicked.

1. Create List structure data page D_CSQueuedTasks with InteractionID parameter.
2. Create data transform (Rule-Obj-Model) Embed-PegaCA-IntentCategory.CSRemoveQueuedTask with TaskLabel parameter, which is marked Required.
3. Create PegaCA-Work-Interaction.CSQueuedTasks section. Add a Repeating Dynamic Layout using D_CSQueuedTasks data page. Pass D_CPMPortalContext.pyID parameter.
4. Inside the repeating layout, add CSDisplayQueuedTasks section include.
5. Update PegaCA-Work-Interaction.CPMInteractionTasks section.
6. Add CSQueuedTasks section include at the bottom of first dynamic layout.
7. Create Embed-PegaCA-IntentCategory.CSDisplayQueuedTasks section.
8. Add a Column Layout (Two Column (Sidebar-Main).
9. Use Task button container format, and select Hide left sidebar when nothing is visible option.
10. Inside Sidebar (Simple list), include an icon with PNG image.

11. Under Actions Tab, run CSRemoveQueuedTask data transform, and include CPMInteractionTasks section under Refresh-Other section.
12. In Main layout (Simple list), add link for .pyLabel.
13. Use Standard task Control format in Presentation Tab.
14. Add Click event to Create Work and Delete Item under Actions tab.
15. Update Rule-PegaCA-Intent-Task.CPMDisplayTaskInMenu section. In the first two dynamic layouts of the first .pyLabel field, update the Actions Tab to also pass label as a parameter to function queueIntentTask.

16. Create PegaCA-Work-Interaction.CSQueueTasks activity. Loop over each embedded page. See below for Java in Step 2:

String str_QueuedTasksList =  tools.getParamValue("QueuedTasks");
String todo_tasks[] = str_QueuedTasksList.split(",");
ClipboardProperty QueuedTasks_pxResults = tools.getProperty(".pxResults");

for(int i=1;i<todo_tasks.length;i++){
 String[] taskParams = todo_tasks[i].split(":");
 ClipboardPage queuedtask_page = tools.createPage("Embed-PegaCA-IntentCategory","IntentTask");
 queuedtask_page.putString("Name",taskParams[0]);
 queuedtask_page.putString("pyClassName",taskParams[1]);
 queuedtask_page.putString("pxFlowName",taskParams[2]);
 queuedtask_page.putString("pyLabel",taskParams[3]);
 QueuedTasks_pxResults.add(queuedtask_page);
}
 

 

 
Make sure to select “Allow direct invocation..” because this Activity is called from a JS function:
 

17. Create PegaCA-Work.CSReloadQueuedTasks activity. Loop over each embedded page.

When logic for Step 2.1:
 

 

 

18. Update PegaCA-Work.PerformDefaults activity. Add a new Step 2 to call CSReloadQueuedTasks.
 

 
Use the same When logic in Step 2 as in Step 1:


Use the same transition logic in Step 2, and disable this logic from Step 1 (to ensure it does not Exit and never run Step 2):
 

19. Update pega_cpm_IP_EventManager.js text file, and update function queueIntentTask( ) to include Label.
 
function queueIntentTask(param_TaskName, param_TaskClass, param_TaskFlow, label, RemoteCaseType,event)
{
     var UniqueTaskId = new Date().getTime()
     gSelectedTasksStack.push({TaskName:param_TaskName, TaskClass:param_TaskClass, TaskFlow:param_TaskFlow, label:label,
     RemoteCaseType:RemoteCaseType,UniqueTaskId:UniqueTaskId});      
     /* set unique attribute for the element */
     var currentDomElement = pega.util.Event.getTarget(event);
     $(currentDomElement).parents().eq(4).attr("UniqueTaskId",UniqueTaskId);
}


Also, function launchTasksSelected( ) was altered in a few places and function queueselectedtasks() was added so just replace the entire launchTasksSelected function with the following:

function launchTasksSelected() {
 
                    gSelectedTaskListSize = gSelectedTasksStack.length;
                    if(gSelectedTaskListSize == 0){
                                        return;
                    }
                    else if(gSelectedTaskListSize > 0) {
                                                           
                                copySelectedTasksStack = gSelectedTasksStack;
             
                   queueselectedtasks(copySelectedTasksStack);
                               
                                 var thisTask= copySelectedTasksStack.shift();
                                 var thisTaskClass = thisTask.TaskClass;
                                 var thisTaskFlow = thisTask.TaskFlow;
                                 var flowParams = "";
                                 if(thisTask.RemoteCaseType != "")
                                      flowParams += "&RemoteCaseType="+thisTask.RemoteCaseType;
                                  if(thisTask.IsNonNativeCase != "")
                                       flowParams += "&IsNonNativeCase="+thisTask.IsNonNativeCase;
                   
                      pega.desktop.createNewWork(thisTaskClass , "", thisTaskFlow , flowParams , "", "", "", "");
 
                       }
                       }
 
function queueselectedtasks(copySelectedTasksStack){
 
  var QueuedTasks = "";
                    for(var selectedTaskIndex in copySelectedTasksStack) {
                          var selectedTask = copySelectedTasksStack[selectedTaskIndex];
                          if(!selectedTask) continue;
            
                         QueuedTasks += selectedTask.TaskName + ":" + selectedTask.TaskClass + ":" + selectedTask.TaskFlow + ":" + selectedTask.label;
                         QueuedTasks += ",";                                                                             
                    }
                                                           
  var oSafeURL = new SafeURL("PegaCA-Work-Interaction.CSQueueTasks");
 
        oSafeURL.put("QueuedTasks",QueuedTasks);
 
                       pega.util.Connect.asyncRequest('POST', oSafeURL.toURL(), {
                         success:function(oResponse){
                              console.log("success");
                         },
                         failure: function(){
                            console.log("failed");
                         }
                   }, "");
 
}

Published September 15, 2016 - Updated December 2, 2021

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us