Skip to Content
Author's profile photo Jay Shukla

Fiori Task List Refresh

Post implementation of custom Fiori Apps, we faced issue related to Delay/Manual refresh required to refresh the Fiori Task list. This blog provides information regarding the Fiori Task list and its refresh behavior based on the task type (Synchronous/Asynchronous). Information about the Task Type and how it is completed has also been provided. This article also provides information how to go about the task design for Fiori Applications.

Here I cover the following topics

  • Fiori Task List
  • Task Type – Synchronous or Asynchronous
  • Task Completion and Refresh
  • Fiori Task Design



Fiori Task List


Work items assigned to a user are displayed in a master detail view.

On completion of task, the work item is removed from the list.

Task List1.jpg


Fiori Task List Refresh Flow

A Fiori task list is refreshed as per the following steps

Fiori Refresh Flow.jpg

Task Overview

A task is removed from the list once it has been completed. A task completion depends on the way it has been created. A task can be created as Synchronous or Asynchronous. The task gets this Sync/Async property from the Business Object Method

Business Object.jpg Workflow Task Property.jpg

Asynchronous Synchronous
When

We define a method as an asynchronous method if we want a task that uses this method to be terminated only via events.

The following are possible reasons for defining a method as asynchronous:

  • The function within the method uses the update task
  • The method is terminated by an event generated when the update task is successful.

You define a method as a synchronous method if we want to use the processing results as method parameters or results.

The following are possible reasons for defining a method as synchronous:

  • The function within the method does not use an update task
  • The method is “just” to be executed
Definition
  • A task that refers to an asynchronous object method must be defined with at least one terminating event. If we define an asynchronous method, we must ensure that one of the terminating events is triggered after execution of the method.
  • At runtime, the relevant work item is only terminated if one of the defined terminating events occurs.
  • A task that refers to a synchronous object method can be defined with terminating events.
  • At runtime, the relevant work item is generally terminated when the synchronous method has been successfully executed.
  • But the work item can also terminated if one of the defined terminating events occurs.
Example The task in which the method Process sales order is executed is also terminated by the event Customer unable to pay. The method Display for displaying an object.

An Asynchronous task has to be completed by using a terminating event.

Task Termination.jpg


Task List Refresh

A synchronous task would disappear from the Fiori task list as soon as it is completed. In case of an asynchronous task, the completion of the task depends on the event processing mechanism.Again, these events may be using the Event Queue mechanism or would be delivered as soon they were raised. However some delays are expected in processing of the event and subsequent task completion.

As a result of this, a task list based on an asynchronous task may not get refreshed as soon as the action is performed on the task.

Task Definition – Points to consider

Custom Task

First preference should always be given to define task as Synchronous task

For completing a synchronous work item, FM SAP_WAPI_WORKITEM_COMPLETE can be used.

Asynchronous Task (Standard or Custom)

Irrespective of whether the task is standard or Custom, communicate upfront about the task list refresh behavioral issues

The user should be communicated about expecting task to remain in the list sometimes. To refresh the list in these cases, manual refresh will be required.

I hope this blog is helpful in some way.


Thanks for reading and any comments/questions please comment below.

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Venkatakalyan Karanam
      Venkatakalyan Karanam

      Hi

      Please let me know , if there is any solution to resolve this refresh issue, in case of Asynchronous Tasks.

      Currently we are using below version

      Version : UIX01CA1 1.00 with SP Level 006 (SAP MM Custom workflows with Asynchronous Tasks)

      Will Refresh issues resolve when we upgrade to Next higher version of MyInbox 2.0 SP03 version or  The refresh issues will be there for any version as long as our Task is Asynchronous .

      Do we need to change the Task type as synchronous task and use SAP_WAPI_WORKITEM_COMPLETE to finish the Task in Workflow to eliminate this issue.

      Please let me know.

       

       

      Author's profile photo Oliver Walter
      Oliver Walter

      The author is not an SAP associate, but as far as I know the Task List refresh does even NOT work with MyInbox 2.0 SP04 and asynchronous Workflows. We tried several variations using the onTaskUpdate() API of My Inbox according SAP Note 2305401 – Integration of SAPUI5 Fiori Applications into My Inbox 2.0 for configuration details. But the API will just update the Task itself and not the Task List, which is at least in our case useless as we use openMode=replaceDetails and therefore we will get an error, as in most case the task as been processed already.

      We currently try to implement a custom method in S2 Custom Controller of My Inbox that executes this.oDataManager.fireItemRemoved(). According above Fiori Task List Refresh Flow diagram, this should trigger an refresh of Task List.

      Regards Oliver

       

      Author's profile photo Sundeep Sethi
      Sundeep Sethi

       

      Hello Former Member ,

      We also have My Inbox 2.0 SP04 and facing the same issue, for asynchronous type tasks when we approve the work item is approved and the task disappears from the Master List but the Details pane still shows the page of the Approved Work Item and No work item is selected in the Master List, the InstanceId parameter in the URL still holds the old work item instance Id. If I manually Refresh the Master list using the Refresh icon the next work item is selected and the Detail Pane is also refreshed.

      I can see that the methods "onUpdateFinished" and  "fnFindAndSelectNextTaskAfterAction" are called in the S2.controller.js. the method "fnFindAndSelectNextTaskAfterAction" in turn calls the "this.oDataManager.fireRefreshDetails();" which does the trick to refresh and select the next work item in the Master List. However with asynchronous type of tasks the refresh does not work completely fine. Can you please suggest how you called the method in the DataManager to fire the refresh or itemRemove event. Did you create a copy of the "CA_FIORI_INBOX" or wrote the code to Override the method in your enhancement of the app.

      Thanks in advance for your response.

      Regards,

      Sundeep

      Author's profile photo Noël Hendrikx
      Noël Hendrikx

      After some trial and error, I managed to refresh the master list after approving / rejecting.

       

      Create an extension of the CA_FIORI_INBOX and extend the S3 controller. A file S3Custom.controller.js will be created.

       

      Now you will need to overwrite one function, called sendAction.

       

      sap.ui.controller("cross.fnd.fiori.inbox.ZCA_FIORI_INBOX.view.S3Custom", {
      
          // Overwrite SAP function
          sendAction: function (sFunctionImportName, oDecision, sNote) {
              var that = this;
              var sSuccessMessage;
      
              switch (sFunctionImportName) {
                  case "Release":
                      sSuccessMessage = "dialog.success.release";
                      break;
                  case "Claim":
                      sSuccessMessage = "dialog.success.reserve";
                      break;
                  case "AddComment":
                      sSuccessMessage = "dialog.success.addComment";
                      break;
                  case "Confirm":
                      sSuccessMessage = "dialog.success.completed";
                      break;
                  case "CancelResubmission":
                      sSuccessMessage = "dialog.success.cancelResubmission";
                      break;
                  default:
                      sSuccessMessage = "dialog.success.complete";
              }
      
              switch (sFunctionImportName) {
                  case 'AddComment': {
                      var oItem = this.oModel2.getData();
                      var oCommentsControl = this._getIconTabControl("Comments");
                      this._setBusyIncdicatorOnDetailControls(oCommentsControl, true);
                      this.oDataManager.addComment(oItem.SAP__Origin, oItem.InstanceID, sNote, jQuery.proxy(function (data, response) {
      
                          // update the comments data and comments count
                          if (oItem.Comments && oItem.Comments.results) {
                              oItem.Comments.results.push(data);
                          } else {
                              oItem.Comments = {
                                  results: [data]
                              };
                          }
                          oItem.CommentsCount = oItem.Comments.results.length;
                          this._setBusyIncdicatorOnDetailControls(oCommentsControl, false);
                          this._updateDetailModel(oItem);
      
                          jQuery.sap.delayedCall(500, this, function () {
                              sap.ca.ui.message.showMessageToast(this.i18nBundle.getText(sSuccessMessage));
                          });
      
                          // update the counter on history tab
                          //this.fnCountUpdater("ProcessingLogs", oItem.SAP__Origin, oItem.InstanceID);
      
                      }, this), jQuery.proxy(function (oError) {
                          this._setBusyIncdicatorOnDetailControls(oCommentsControl, false);
                      }, this));
      
                      break;
                  }
                  default: {
                      this.oDataManager.sendAction(sFunctionImportName, oDecision, sNote,
                          jQuery.proxy(function (oData) {
                              jQuery.sap.delayedCall(500, this, function () {
                                  // EXTEND BEGIN: add function call to refreshListOnAddInboxDone
                                  this.oDataManager.refreshListOnAddInboxDone();
                                  // EXTEND END: add function call to refreshListOnAddInboxDone
                                  sap.ca.ui.message.showMessageToast(this.i18nBundle.getText(sSuccessMessage));
                              });
                          }, this, oDecision)
                      );
                  }
              }
          }
      
      });

      Keep in mind that when SAP changes the sendAction function, you will not get the new functionality!!! So after a inbox patch, check out the origional code, the patched code and your code.

      This should do the trick.