Unique Email Creation

Hi,

I have First Name, Last Name data with that data i need to create email generation

First Name Last Name Employee Email
Mohammad Akbar gmail.com
Venkata Ramana gmail.com
Sridhar Reddy gmail.com
John Hubert gmail.com
Shushant Singh gmail.com
Ashok Divi gmail.com
Subha Sri gmail.com
Shaik Basha gmail.com
Venkata Ramana gmail.com
Sai Srinivas gmail.com
Sravani Guduru gmail.com
David Miller gmail.com

I want to take First name and last name for generation of email
For example:

I have 2 records consist of Venkata Ramana they i need to give unique email like
VenkataRamana@gmail.com
Venkata.Ramana@gmail.com

How to tackle this situtation

Regards
Sai

Hi @Sai.Srinivas ,

Could you let us know what would need to be added to the names if there are more than 3 records having the same names ?

Is it a random addition of characters in the email username or do you have to follow an rules for it ?

It is random characters itself. i need to create unique emails for each of the record in excel

Regards
Sai

I would like to know, is this multiple time requirement or you want to generate emails for this above sheet only?
If you want to run this email generation logic many time in future then generated email ids should be stored in a DB or Orch. as you need to check for already exist or not in each run.

@Aakash_Singh_Rawat

I want to run for future use as well for different records but template is same

Okay,

Then my suggestion is: Use DB or Orch data service to store these generated mail ids.
1 Read sheet having employee data
2 Loop over it and concat all 3 values (First Name+Last Name+Email) with CurrentRow(0).ToString()+CurrentRow(1).ToString()+CurrentRow(2).ToString()
3 Condition to check if this email id is already exist in DB or not:
If not:
Save in local sheet to retrieve temporary and also in DB for future use.
If already exist:
Concat with random string or number using UiPath.Testing.Activites.Test.Data.RandomNumber activity for e.g. abcxyz12@gmail.com.

@Sai.Srinivas ,

We could use the Guid Method to generate a unique Id, although it is a bit irregular.

Guid.NewGuid.GetHashCode.tostring("x")

image

Also, as mentioned by @Aakash_Singh_Rawat , we would have to store these created emails in a stored location, either as a master Excel sheet or in the DB.

Then in the next runs, we read this Master Excel sheet, then check if the newly created Guid is already present in this list. If present, then we create the unique Id again using loops.

Can I have a sample code of it. it could be easy to understand better

Sure, will share it.

Hi @Sai.Srinivas ,

Please find the main.xaml.
Note: I’m assuming you will use generated email ids to store in a master excel sheet named Email.xlsx.
Data.xslx is the sheet you will have time to time for which you want to generate email ids.

Data.xlsx (9.9 KB)
Emails.xlsx (9.1 KB)
Main.xaml (13.2 KB)

@Aakash_Singh_Rawat

Can you resend xaml file i cant open it dependencies missing

You can create a blank process and replace the shared main.xaml, I haven’t used any specific packages but defaults one.