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

Trigger when new portal user is created

I'm trying to catch the event of a new Customer Portal user being created.


I created a trigger on the User object:



trigger UserAfterInsert on User (after insert) { for (User u : Trigger.New) { System.debug('\n**** New User: contact ID: '+u.ContactId+'; IsPortalEnabled: '+u.IsPortalEnabled); } }


The output is:


**** New User: contact ID: 003S0000006mT5jIAE; IsPortalEnabled: false


isPortalEnabled is FALSE... If I query the database for this user after the trigger, isPortalEnabled is TRUE...


I imagine I could just look at the Profile Type, but I want to understand why this isn't working...