Skip to Content
0

How to add multiple buttons in SAP Cloud Fiori Inbox footer?

Mar 02 at 04:45 PM

118

avatar image

Hi,

I want to add multiple buttons in Fiori Inbox task footer.

Question 1: I want to add 2 buttons in Inbox task footer with type = “Accept”. But the issue is only button with type “Accept” gets added(Same with Reject). When I open the task, only the last added action ie “Validate” button is shown in the footer. Is this expected behavior?

action = "Approve"; //action 1
startupParameters.inboxAPI.addAction({
action:oApproveAction.sBtnTxt,label:oApproveAction.sBtnTxt,type: "Accept"
}, oApproveAction.onBtnPressed);

action = "validate"; //action 2
startupParameters.inboxAPI.addAction({
action:oValidateAction.sBtnTxt,label:oValidateAction.sBtnTxt,type: "Accept"
}, oValidateAction.onBtnPressed);

Question 2:

As a workaround to issue in Question 1, I tried adding 2 buttons(Approve and Validate) with type=” Emphasized”. I am able to see both the buttons in footer. But now the issue is, when I click on the button that I added first (Approve button), the “Validate” action is being called. This means, the first action with type=” Emphasized” is being overwritten with second button with type “default”. So, Again, like Issue in Question 1, I am able to only call one action. Is this expected behavior?

What is the workaround to add multiple buttons with same type? I have around 4 buttons to be placed in footer as per the client requirement.

I would like to use standard footer because I need “Claim” and “Show log” feature.

action = "Approve"; //action 1
startupParameters.inboxAPI.addAction({
action: oApproveAction.sBtnTxt,label:oApproveAction.sBtnTxt,type: "Emphasized"
}, oApproveAction.onBtnPressed);

action = "validate"; //action 2
startupParameters.inboxAPI.addAction({
action: oValidateAction.sBtnTxt,label:oValidateAction.sBtnTxt,type: "Emphasized"
}, oValidateAction.onBtnPressed);

Thanks,

Shilpa

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Arpit Oberoi Mar 02 at 05:22 PM
0

Hello Shilpa,

Did you try by removing the 'type'? I am not too sure whether Inbox app will allow 2 buttons of type 'accept(green)' and 'reject(red)'. But I could be wrong in assuming that. As per following screen-shot from sapui5 library, it's not clear whether you can use same types.

Regards,

Arpit


capture-sapui5.png (71.8 kB)
Show 6 Share
10 |10000 characters needed characters left characters exceeded

Hi Arpit,

Thanks for the hint.Here, I am using standard SAP Inbox. Even if i remove "type", only the latest added button action is considered.

Thanks,

Shilpa

0

Hello Shilpa,

No problem. I am not aware of any restriction on number of buttons. If you add bleow code 5 times with your texts,does it not place 5 buttons in your aplication? I presume you are developing a custom UI which will open your task in My Inbox app?

startupParameters.inboxAPI.addAction({
					action: "Approve",
					label: "Approve"
				}, function(button) {
					this._completeTask(taskId, true);
				},
				this);

0

Hi Arpit,

The standard Inbox does not accept more than one button of same "type". If I add "addAction({...) code 5 times, only the latest action is added. The behavior is same if "type" is not provided like you meantioned.

Thanks,

Shilpa

0

Hello Shilpa,

Would you mind sharing your code? I just tried quickly adding buttons on UI and I was able to. Please see below screen-shot:

ui.png (15.1 kB)
0

Hi Arpit,

Thanks for trying out.

In your code, have different actions on each button and try to check what action is called. On click on any button, only the last added buttons action would be called. This is the issue. I have no means to determine what button got clicked.

PS: If you don't give the "type" then you can add the button in footer, but same action is called on click of every action.

If you have 2 buttons with same "type" as "accept"(or both button as "reject"), then only one Button is shown.

Thanks,

Shilpa

0

Are you sure you have defined a different "Action" value for each button?

Again, adding multiple buttons with different actions should not be an issue.
The only restriction is that you cannot have more than one button of type positive/negative.

0
Archana Shukla
Mar 04 at 03:50 PM
0

Hello Shilpa,

Answer1: You cannot add two buttons of same type as "Accept" or "Reject". There could be only one button of one type in My Inbox.

Answer2: What are these 4 buttons for? Ideally you can either Approve or Reject/ Accept or Decline etc. in My Inbox.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Archana,

Answer1 - OK,

Answer 2: I have 5 buttons "Validate" (Mandatory & data validations), "Save", "Approve" , "Reject" & "Cancel Process". Does it mean I cannot place all these buttons in Inbox footer? Any workaround other than moving other buttons to UI screen? If possible. I want to avoid placing few buttons at UI level and few in footer.

Thanks,

Shilpa

0