Okta Claim Null checking for expression

I was reading Okta Expression Language overview guide | Okta Developer but couldn’t find what I’m looking for.

Using a simple example, I can write something like
user.firstName == null ? 'Empty' : user.firstName

Is there a cleaner way to do this? Ideally, I would like to do something like in C#
user.firstName ?? 'Empty'

Thanks!

Your solution looks right to me and matches how you should write conditionals in Okta Expression Language

You may want to keep in mind that an attribute can be either null (never been populated) or an empty string (populated previously, then cleared) and you may want to adjust your expression accordingly (example for this in our docs).

Thanks for the reply. Doing this conditional would work for me, but the evaluation will be lengthy. This means that the lengthy portion will be duplicated.
ex)
(somelenghtyEvaluation) == null ? ‘Empty’ : (somelenghtyEvaluation)

Just wondering if there’s a cleaner way.

Not that I’m aware of

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.