+ Start a Discussion
sfmakersfmaker 

Check if Customer Portal User exists for a Contact

Hi there,

 

How do I check if a Customer Portal User already exists for a contact. I am writing a trigger on Contact that generates a Customer Portal User for a Contact (under certain conditions) and I need to check that a Customer Portal User does not already exist for this Contact before attempting to create one.

 

Thanks in advance for your help

Best Answer chosen by Admin (Salesforce Developers) 
CLKCLK

query for user will check iCustomer Portal User already exists for a contact.

[select from user where CustomerPortalUser = true and contact : objeContact.ID];