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
John McAfeeJohn McAfee 

IsPortalenabled on Contact object

Hi all, We have a community portal and as we enable account contacts to use the portal, a flag is set on the user object (IsPortalEnabled). My goal is to have this same flag on the contact object so that we can then do other things for that contact easily knowing they are a portal user. I have created a formula checkbox on Contacts and I need to evaluate 3 conditions on the user object then set the contacts formula field to true. The 3 fields are User.username = Contacts.email AND User.IsActive = TRUE AND User.IsPortalEnabled = TRUE

My 2 issues are,
1.  evaluating 3 AND statements to be true   
2. In the advanced formula of the field, it does not look like User.IsPortalEnabled is exposed to evaluate.

Here is my attempt at doing this but regardless of my bad syntax, If User.IsPortalEnabled is not exposed, then I think I cant do it this way.. 

Any help would be appreciated. 

IF(
AND($User.Username = Email, $User.IsActive, $User.IsPortalEnabled = True ), IsPortalEnabled__c = TRUE, NULL
)
John McAfeeJohn McAfee
Checking back to see if anyone has some thoughts..  Thanks for any help
Charles ThompsonCharles Thompson

Hi @John McAfee

If it's too late for this, I hope you found a solution.

If not, here's an approach:

  1. Understand how the data model works.  There's no lookup from Contact to User for this purpose.  This is more a master (Contact) / detail (User) relationship, so a formula field won't work.
  2. Add a Checkbox field to Contact.  Make it read-only on the page layout(s).
  3. Create a Process Builder that fires on User create or update (or add to any such existing PB, since best practise says use one PB per object)
  4. Add a condition (blue diamond): If IsActive = True AND IsPortalEnabled = True AND Contact ID is null FALSE
  5. Add an action: Type: Update Records; Select a record related to the user; [User].ContactID (don't select the ContactID with an arrow beside it); Field to update: <your field from step 2 above> = TRUE
  6. You could add other updates on the related contact that make sense at this stage
  7. That covers new and updated user records going forward. You also need to update all previously-created records.
  8. Using Data Loader (or a report), export ContactID from User where isActive = TRUE, isPortalEnabled = TRUE, and ContactID is not null (export to CSV file)
  9. Edit your CSV: add a column for your field in step 2 above, and populate it with "TRUE" for every row
  10. Using Data Loader, Update Contact with the CSV file, mapping ID to ContactID and your field from step 2.

So what have you done? 

You have set up PB so that future new or updated portal users will update the Contact record automatically.
You've also updated existing contact records so they reflect their related user records.