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

Issue with beforeupdate Trigger on User object

I've got a beforeUpdate trigger on user that is supposed to do some work when the user is deactivated.  However the code seemed to not pass the below condition:


if (i.isactive == false)
   //do some work here


Shouldn't I be detecting for the Isactive field for this?  



Jake GmerekJake Gmerek
My first thought is that a before insert trigger will not fire at all in this case as the user is already inserted. I would try a before update trigger.
My bad, I meant beforeupdate trigger. Not enough coffee this morning.

Your logic is correct and it should work. If you could post your code,i may be able to help you further.


i tried something like this and it worked.


trigger beforeUpdateonUser on User (before update) {
    List<User> ulist=new List<User>();
        User uold=Trigger.oldMap.get(;
        if((u.IsActive==false) && (uold.IsActive ==true)) {
            u.FirstName ='Inactive User';