+ Start a Discussion
krish_krish_ 

Global Function to check the Salesforce Username...

Hi to all,
I want to create user in my organisation through code using contact record values.
I use the User's Username as contact Email Field.

How do I check the Email id is not repeated in whole salesforce DB???
Is there any global functions are there???
Send me the sample code...

Thanks,
Krish.
Sam.arjSam.arj

Use SOQL in your code.

 

 

Lisr<User> users = [SELECT id, name FROM User WHERE username = :email];

 

 

 

krish_krish_

The above SOQL query is retrived only for the my Organisation user's only.

I want to check the whole Salesforce user names..

How to write the SOQL query to check the user's  username on salesforce DB???

 

Thanks,

Krish.

 

MyAwesomeAliasMyAwesomeAlias

I believe you are going to have to try to create the user and then catch the exception in the event that the username already exists.

Devendra SawantDevendra Sawant

how i can populate roles from my organisation??

can you provide me code for it??

geetgeet
Hi krish,
have u succeeded in querying the entire salesforce database?

Thanks,
geet.