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
sgoldberRHsgoldberRH 

flag to identify Customer Portal users

Hi I've written a trigger to send emails off the case object in certain scenarios, but I only want this trigger to fire when the user making updates is an internal user and not a customer portal user. Currently I have an If statement that says when profileid <> the customer portal ids. This is not very maintable, is there a flag that I can use to identify if a user is a customer portal user?

 

Thanks. 

Best Answer chosen by Admin (Salesforce Developers) 
Walter@AdicioWalter@Adicio
target

Profile.UserType = 'PowerCustomerSuccess';

or

Profile.UserType = 'CustomerSuccess';

All Answers

Walter@AdicioWalter@Adicio

I created a string to capture the profile name for the current user and then i check my string for the words customer portal.

 

 

 

String pName = ''; for( User u : [SELECT Id,Profile.Name FROM User WHERE Id = :userInfo.getUserId()] ) {pName += u.Profile.Name;} pName.contains('customer portal') ==true;

 


 

Walter@AdicioWalter@Adicio
target

Profile.UserType = 'PowerCustomerSuccess';

or

Profile.UserType = 'CustomerSuccess';
This was selected as the best answer