Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Email Generation for different Domains

SanketBhandhari
New Contributor
New Contributor

Hi All,

We are maintaining identities for our client with email generation rule of firstname.lastname@abc.com.

Now client wants to onboard identities from different organization which will be having emails of firstname.lastname@xyz.com.

How this can be handled in Email Generation Rule based on the attribute which we might be using to segregate the identities e.g. any custom property.

We want logic in the manner.

If CP1 = abc then firstname.lastname@abc.com otherwise firstname.lastname@xyz.com.

Regards,

Sanket Bhandhari

16 REPLIES 16

PremMahadikar
All-Star
All-Star

Hi @SanketBhandhari ,

If the domain is saved in customproperty1. Did you try to configure like below:

PremMahadikar_0-1715600636611.png

 

PremMahadikar_2-1715600687101.png

 

If this helps your question, please consider selecting Accept As Solution and hit Kudos

Hi Prem,

Thanks for the reply, but we want generate emails with different domains, email generation rule will not be helpful in this.

We need logic for advance query.

Regards,

Sanket Bhandhari

@SanketBhandhari ,

Okay. Try below logic in advance config

CASE WHEN users.customproperty1='XYZ' THEN CONCAT(users.firstname,users.lastname,'@',users.customproperty1,'.com') ELSE CONCAT(users.firstname,users.lastname,'@abc.com') END

 

If this helps your question, please consider selecting Accept As Solution and hit Kudos

case when users.customproperty31 = 'abc' THEN concat(users.customproperty47,@abc.com) ELSE concat(users.customproperty47,@xyz.com) END

We are using above logic Prem but it is not working out.

Regards,

Sanket Bhandhari

Please share logs


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Here are the logs Rushikesh.

IF(users.customproperty31 = 'abc', CONCAT(users.customproperty47, '@abc.com'), CONCAT(users.customproperty47, '@xyz.com'))


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

It didn't worked Rushikesh.

Attaching logs.

Regards,

Sanket Bhandhari

@SanketBhandhari ,

Please pass the hardcoded value in quotes.

case when users.customproperty31 = 'abc' THEN concat(users.customproperty47,'@abc.com') ELSE concat(users.customproperty47,'@xyz.com') END

 

If this helps your question, please consider selecting Accept As Solution and hit Kudos

Even with the quotes, it didn't worked.

Regards,

Sanket Bhandhari

Murmur
Regular Contributor III
Regular Contributor III

Hi @SanketBhandhari 

I'm expecting you create these users manually.

I'm pretty confident that this will not work, when you create the User directly from Admin > Identity Repository Users. Why? Because during the initial creation CP1 is not set, but it is rather filled, after the User is already created. 

You could try to create a Create User Request form, that already fills CP1 and create the User with that. 

If you create the Users on Import you are better off, assigning the email on import, rather than using the email generation rule.

Just my 2 cents, I hope it helps

Cheers 🙂

 

@SanketBhandhari ,

 

case when users.customproperty31 = 'abc' THEN concat(users.customproperty47,@abc.com) ELSE concat(users.customproperty47,@xyz.com) END
  • The above code works for me. I can create 'xyz' and 'abc' domain emails for newly created users.

PremMahadikar_1-1715696149957.png

  • Please check your input file. I would suggest you use simple .csv file. I checked the logs, as you are passing many columns.
  • My columns were: 
    statuskey,firstname,lastname,systemusername,username,customproperty31,customproperty47
  • Just for testing, please pass all the values
  • And select 'Generate User Email' during import
  • It should work

 

If this helps your question, please Accept As Solution and hit Kudos

Santosh
Regular Contributor
Regular Contributor

Hello there, we have the same requirement too, i.e. Multiple domains, addition to above, we need to handle the duplicate detection and autoincrement with tan index of 1. I have the following logic in place, but I am getting an email with index 1, even though the user is unique (only one identity), what could be changed to the following logic?

case when ((users.companyname='xyz')
THEN
concat(users.firstname,'.',users.lastname,'@xyz')#
concat(users.firstname,'.',users.lastname,'1','@xyz')#
concat(users.firstname,'.',users.lastname,'2','@xyz'))
ELSE
(concat(users.firstname,'.',users.lastname,'@abc')#
concat(users.firstname,'.',users.lastname,'1','@abc')#
concat(users.firstname, '.',users.lastname,'2','@abc')#
concat(users.firstname,'.',users.lastname,'3','@abc'))
END#

Did you checked logs?


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

The log has RULERUNJOB --->Generate User Email Action_Started and next thing is email generated with index1. I have attached the log below,

The log indicates an SQL syntax error in the query used within your workflow. The issue lies in the case statement construction. It appears there's an unnecessary THEN keyword causing the syntax error.

 

Use below code

 

case 
  when users.companyname = 'xyz' then
    concat(
      concat(users.firstname, '.', users.lastname, '@xyz')#
      concat(users.firstname, '.', users.lastname, '1', '@xyz')#
      concat(users.firstname, '.', users.lastname, '2', '@xyz')
    )
  else
    concat(
      concat(users.firstname, '.', users.lastname, '@abc')#
      concat(users.firstname, '.', users.lastname, '1', '@abc')#
      concat(users.firstname, '.', users.lastname, '2', '@abc')#
      concat(users.firstname, '.', users.lastname, '3', '@abc')
    )
end#

 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.