Okta Expressions - IF/Than/Else - Populating Mobile Number into Active Directory from Workday Skip to main content
https://support.okta.com/help/answers?id=9062a000000dfoiqaw&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Van HuynhVan Huynh 

Okta Expressions - IF/Than/Else - Populating Mobile Number into Active Directory from Workday

Hi all,
I'm new to Okta's expression language and I'm trying to work out an issue I'm having with a new project initiative involving automating signatures via Mimecast (mail going out) and Office 365 (internal mail only).

I'm trying to pull the mobile number value from Workday (our HR system) into AD attribute customAttribute15, but i'd like to have the word "Mobile" appear before the phone number, if it exists.  If it does not exist then I'd like to return nothing.

Example:
workday.mobilePhone = 555-555-5555

This is what I have so far:
String.len(workday.mobilePhone) > 0 ? String.join("Mobile", + workday.mobilePhone) : null

My thought process on this was that if the variable length is greater than no characters, then add "Mobile" and the phone number pulled from Workday.  Otherwise return nothing.

I keep getting the error "Error in Evaluating Expression", but I believe it works for users that do not have a mobile number populated.

Any expert advice would be greatly appreciated.

Regards,
Van Huynh
Best Answer chosen by Van Huynh
Van HuynhVan Huynh
Thank you very much for the response Jaypee!  I still got an error with that try but you definitely simplified the code and gave me a great lead and I got it working!  The expression that worked was:

workday.mobilePhone != null ? "Mobile " + workday.mobilePhone : null

I guess we just didn't need the parentheses.

We do testing for automated Office 365 signatures using the extensionAttribute tomorrow!

Cheers!
 

All Answers

Jaypee ManansalaJaypee Manansala (Okta)
Hi Van,

Thanks for posting your inquiry in Okta Community Portal.

Try using this custom expression:

workday.mobilePhone != null ? ("Mobile" + workday.mobilePhone) : null

Best,

JPM
Van HuynhVan Huynh
Thank you very much for the response Jaypee!  I still got an error with that try but you definitely simplified the code and gave me a great lead and I got it working!  The expression that worked was:

workday.mobilePhone != null ? "Mobile " + workday.mobilePhone : null

I guess we just didn't need the parentheses.

We do testing for automated Office 365 signatures using the extensionAttribute tomorrow!

Cheers!
 
This was selected as the best answer