function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

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) 

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

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