cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic image change in flavour in Personas 2.0

former_member193190
Participant
0 Kudos

Can we change image dynamically in any flavour based on user login in SAP Screen Personas 2.0 ?

Accepted Solutions (1)

Accepted Solutions (1)

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

Not sure what the use case would be for something like this, but I suppose you could add an HTML viewer to the page covering the whole canvas, and change the URL to an image that is different depending on a user.

former_member193190
Participant
0 Kudos

how to change the url based on user in Personas2.0?

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

With a script that is tied to the OnCreateHandler event of the screen.

You'd have to code the logic deciding which URL you want for what user.

You'll have to figure out the current user name which is available by navigating to System -> Status. Alternatively, you could write a WebRFC taking care of the logic of user determination and maybe even building the URL..

former_member193190
Participant
0 Kudos

Do you have any document regarding "OnCreateHandler" and "WebRFC"?

former_member193190
Participant
0 Kudos

Hi,

Thanks for the reply...

I have gone through the links and tried it out with but, 'On Create Handler' option is not available.

Also if we can change the status of the button (for eg. hide/unhide), can we change a image of the flavor in a background depending on the user login details using scripting?

Awaiting for your valuable reply...

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

You have to select the User Area to access the OnCreateHandler for the page:

Dynamic hiding of controls is not a standard provided feature in Personas 2.0. There is a way to do it (with some caveats) but this wouldn't help you in your original use case of changing the background picture anyway. The solution can be found here in this same SCN space if you're interested in this.

As I mentioned earlier, it is possible to do what you're looking for but you have to know basic scripting and/or WebRFC coding to make it happen. However, it is NOT possible to swap out the assigned background picture with scripting.

If you go down the HTML viewer route, first you'd have to find out how to make the decision about what picture is needed for which user. And I'm still not clear why would you want to do something like this in the first place

former_member193190
Participant
0 Kudos

Hi Tamas,

Thanks for the answer!!

while exploring the script button in personas2.0 , I am unable to find the way to change the properties of the controls using script.

Is this possible to change or access the control's properties in script in  "PERSONAS 2.0"?

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

In general, you don't have access to controls' properties via scripting in Personas 2.0.

However, in this case, you can change the URL of the image that you are assigning to the HTML viewer covering the area where you want the image to show up.

Do this:

  • Create a (hidden) text field where you will build the URL of the image you want to show (without http:// or https://)
  • Assign the following URL to your HTML viewer: http://{1}
  • Point the {1} variable (with the plus sign) to the text field you just created
  • In your script, build the image URL and paste it into the text field, then refresh the HTML Viewer

This will make the image dynamic, depending on the URL you specify.

Answers (0)