cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling visibility of UI elements in SAP fiori app based on data from backend ?

former_member441692
Participant
0 Kudos

Hi Experts !

I was wondering if it is a suitable approach to develop and control ui element visibility from backend, when there is one application which is common to more than one role and only differs in access to certain buttons on the page among these roles? rather than create three different roles.

For instance an application to view a document which is same for Employee and Manager with only difference that manager gets to approve the report other than viewing it in display mode. In this case, controlling the visibility of Approve button from Odata service where from back-end we can return a variable to enable and disable button if the logged in user is a manager.

Regards.

Accepted Solutions (1)

Accepted Solutions (1)

antonochel
Employee
Employee

I think that this is possible but probably not the most elegant solution.

If you want to do it this way, you definitely need to implement an authorisation check in the button, even if it is set to invisible.

An alternative would be to create the button based on backend data via javascript. It would not be in the xml if it's not created via js, so that might be a safer alternative.

But these are not official recommendations, just my personal thoughts.

former_member441692
Participant

Hi Anton,

Thanks for suggesting. I agree with the alternative.

Regards

Anusha Saxena

Answers (1)

Answers (1)

former_member370623
Active Participant

Hi Anusha,

you can do that sending a bool from backend set visible false. but you should also control role/authroziation in approving method in backend.

former_member441692
Participant
0 Kudos

Hi Ibrahim,

Thanks for your reply. Yes that is what the approach we would have but I was wondering if it is suitable and as per fiori design guidelines given the scenario.

Regards

Anusha Saxena