Loading

Determine if a contact is a portal user

Fecha de publicación: Oct 13, 2022
Descripción
How to determine if a Contact is a Portal User?
Solución

Query the User table and use two key filters

SELECT Id,Name,Email FROM User WHERE Profile.Name = 'Customer Portal User' AND ContactId = '003xxxxxxxxxxxxxxx'
 

Query against multiple contacts 

List<Contact> lContacts = [SELECT Id FROM Contact];
List<User> lUsers = [SELECT Id,Contact.Id,Name,Email FROM User WHERE Profile.Name = 'Customer Portal User' AND ContactId IN :lCont];

NOTE: The first query on Contact will have to be limited so Apex Governor limits are not exceeded.
Número del artículo de conocimiento

000386163

 
Cargando
Salesforce Help | Article