Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Need to generate dummy email if user does not have valid email in Saviynt

Rajesh_IAM
Regular Contributor
Regular Contributor

Hi All.

Its a REST based application.

Requirement: If user has email in saviynt then we need push that email to target, if not then need push sample email like "username@dummyemail.com" to target. Email is one of the mandatory field in create account JSON.

I have tried with below syntax, but its not working.


\"${if(user?.email!=null) {user.email} else {{user.username}'@dummyemail.com'}}\"

Please review this and provide your suggestion on this,

6 REPLIES 6

DixshantValecha
Saviynt Employee
Saviynt Employee

Thank you for contacting the Saviynt forums.

Kindly try the below syntax and let us know if further assistance is needed from our end 

\"${user?.email ? user.email : user.username + '@dummyemail.com'}\"

Here, the ternary operator checks if the user has an email address (user?.email). If yes, then it uses the email address (user.email). If not, it uses the username and appends the @dummyemail.com domain to create a sample email address.

Also, make sure that the JSON payload contains the correct field name for email address and that the syntax for the entire JSON payload is correct.

Rajesh_IAM
Regular Contributor
Regular Contributor

@DixshantValecha  Thank you for help. syntax is working as expected.

DixshantValecha
Saviynt Employee
Saviynt Employee

Thanks for your update we will mark this as a solution.

Rajesh_IAM
Regular Contributor
Regular Contributor

@DixshantValecha  Now client team changed sample email requirement to: firstname.lastname.username@dummyemail.com.  I have updated existing ternary operator as below and its not working.

\"email\":\"${user?.email ? user.email : (user.firstename).(user.lastname).(user.username) + '@dummyemail.com'}\",

Please check this syntax and help me on this issue resolution

DixshantValecha
Saviynt Employee
Saviynt Employee

Thank you for your inquiry regarding the syntax error you are experiencing with the updated ternary operator for the email field.

Please try modifying the operator as follows:

""email":"${user?.email ? user.email : user.firstname + '.' + user.lastname + '.' + user.username + '@dummyemail.com'}","

This should concatenate the user's first name, last name, and username with the domain name to create the email address in the format you require.

If you continue to experience difficulties, please let us know

DixshantValecha
Saviynt Employee
Saviynt Employee

Hi @Rajesh_IAM 

Let us know if the below solution worked for you 

Please try modifying the operator as follows:

""email":"${user?.email ? user.email : user.firstname + '.' + user.lastname + '.' + user.username + '@dummyemail.com'}","

This should concatenate the user's first name, last name, and username with the domain name to create the email address in the format you require.