cancel
Showing results for 
Search instead for 
Did you mean: 

Assign default value to field in Fiori Elements

robmamba25
Explorer
0 Kudos
289

Can a default value be assigned to a field on an object page in the create option from the front-end in SAP Fiori Elements?

View Entire Topic
MioYasutake
Active Contributor

@robmamba25 

The following options are available for prefilling some values in the backend service. Not suitable if you are looking for a way to supply default values from the frontend app, though.

1. NewAction

https://sapui5.hana.ondemand.com/#/topic/11ff444f82e14eb3a2e8eca0065a5055

https://community.sap.com/t5/technology-blogs-by-members/prefilling-fields-when-creating-a-new-entit...

2. DefaultValuesFunction

https://sapui5.hana.ondemand.com/#/topic/5ada91cc1ad8455bbfb7e6aee96383f2

https://community.sap.com/t5/technology-blogs-by-sap/cap-with-fiori-elements-side-effects-custom-act... (Concept-2)

 

 

robmamba25
Explorer
0 Kudos
I need to do it from the frontend since I need to get the user (sap.ushell.Container.getService("UserInfo")) from the IAS to set it in a field that is the requisitioner name in a requisition
gregorw
Active Contributor
But you have this user also available also in the backend.
robmamba25
Explorer
0 Kudos
How would that be? Or how could I do it?
MioYasutake
Active Contributor
0 Kudos

@robmamba25

It depends on where your frontend and backend apps are hosted. For example, if both frontend and backend apps are hosted on an ABAP server, you can get the logged-in user from the sy-uname variable.