Reputation: 489
I want to remove or at least disable the "Claim" button from the footer of the inbox in SAP Fiori.
I already found this question but it only describes removing the approve / reject buttons, which have own properties in the oOptions
.
Probably the claim button is located in the buttonList
array, but setting it like this has no effect:
sap.ui.define([
"sap/m/MessageToast",
"sap/m/Dialog",
"sap/base/Log",
"sap/ui/model/Filter",
"sap/ui/model/FilterOperator",
"sap/ui/model/Sorter",
"sap/ui/core/mvc/Controller"
], function (MessageToast, Dialog, Log, Filter, FilterOperator, Sorter, Controller) {
"use strict";
return Controller.extend("something.controller.App", {
onInit: function () {
this._headerFooterOptions = {
buttonList: []
};
this.setHeaderFooterOptions(this._headerFooterOptions);
// ...
}
});
});
Another possible way could be disabling the button via this.setBtnEnabled(sid, false);
but since I don't know the sID
of the claim button, I can't check this.
I would really appreciate help with this issue!
EDIT: I have no access to the backend, in case anybody has the same issue but can access the backend, see @MrNajzs answer.
Upvotes: 2
Views: 3670
Reputation: 610
There is an option to hide buttons like Forward, Release, Claim via a gateway/backend class. IMO you should go for this approach, and not by extending the MyInbox UI5 app.
Create a subclass in your gateway based on the class /IWPGW/CL_TGW_FACADE_BWF_V2
.
Redefine the method MAP_TASK_ADDITIONAL_FLAGS
. For example, if task id = XXX, don't show Forward, Claim, ...
CALL METHOD SUPER->MAP_TASK_ADDITIONAL_FLAGS
CHANGING
IS_TASK = is_task
.
if is_task-TASK_DEF_ID CS 'XXX'. "your workitem task id
clear: is_task-TASK_SUPPORTS-FORWARD,
is_task-TASK_SUPPORTS-CLAIM,
is_task-TASK_SUPPORTS-TASKOBJECT,
is_task-TASK_SUPPORTS-RESUBMIT.
ENDIF.
Open the provider implementation in spro in your gateway system (sry for german language)
replace your zclass with the standard class /IWPGW/CL_TGW_FACADE_BWF_V2
If you have no access to the backend extend the MyInbox via WEBIDE. In your case you can extend the whole controller(S3.controller.js) or implement a UI Controller Hook(S3.controller.js->extHookChangeFooterButtons). For Extensibility of SAP Standard Apps always take a look at SAP Fiori Apps Reference Library
Example (S3.controller.js - UI Controller Hook Implementation):
extHookChangeFooterButtons: function (oButtonList) {
var sTaskDefinitionId = this.getView().getBindingContext().getProperty("TaskDefinitionID");
switch (sTaskDefinitionId) { //Define your condition
case "XXX":
oButtonList.aButtonList = []; // No Buttons
break;
case "XYZ":
oButtonList.aButtonList.splice(1,1) //No Claim Button
break;
default:
break;
}
}
Upvotes: 2