Using Option Sets to change color based on User's name

I would like to use an option set that sets the color of a background based on the current user’s name.

For example, if we have a user named Adam, I would like the background color to be set dynamically using the first letter of his name ‘A’. If a user was named Bob, then it would set the background color based on the first letter ‘B’.

I have an option set that has 26 letters for the display (A through Z), and an attribute for Color for the HEX code. I am just not sure how to setup the dynamic color using an expression. I can extract the current user’s first name:trimmed 1:uppercase to get the letter, but I don’t know how to apply the correct color from the option set.

Can anyone point me in the right direction?

Hi there, @doug4… I just made a quick example, and this expression appears to do what you described.

Hope this helps.

Best…
Mike

1 Like

Mike,

Thank you very much, this worked perfectly. I’m not sure how long it would have taken me to figure this out, but let’s just say I wasn’t too close.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.