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
dev_hedgedev_hedge 

LastLoginDate and trigger on User Object

It doesn't seem to me that an "after update" trigger will fire on the User object when a user logs in even though salesforce.com must update the field LastLoginDate on this object.
 
Am I missing something?  It would seem to me that if salesforce.com is updating this field on the User record everytime a user logs in then it would also fire the "after update" trigger.
 
thanx for any clarity you can add.
 
odieodie

Dev, All,

 

Is your trigger firing on any field update on the User?

 

I setup an "after update" trigger on the User object and I can't get it to fire. I have tried modifying most fields on the My Personal Information > Personal Information screen and also the manage users > users screen.. but the trigger is not tripped. Any body seen this? Am I missing something? Dev, did you resolve the issue?

 

thanks,

Odie 

 

  

dev_hedgedev_hedge

I finally broke down and created an Apex class that gets executed once a day and dumps the LastLoginDate date field from the user and places it into a custom object.

 

You can create triggers on the User object but the firing is odd to say the least...I recall reading somehwere that you can create "before" triggers on the User object but not "after" trigger.  I'll see if I can dig up the reference.

 

 

dev_hedgedev_hedge

Although you can write triggers on the User object it is still pretty restrictive in what you can do.  It looks like in Summer'08 release salesforce.com started to further limit what you could do with DML inside of triggers on the User object. 

 

If you are interested you can find the reference (Here).  You might have greater success if you set the API version to version 12.0 on your trigger which would coincide with the Spring '08 release of salesforce.com which didn't have these additional restrictions. 

 

I do have triggers written on the User object but they are "before" triggers.  I still couldn't locate the reference to "before only" trigger son the User object so just treat my previous comment as a rumor. :smileyvery-happy:

 

odieodie

Dev, 

 

Your help is much appreciated. Thank you. 

I'll try out a few things too and post what I find. 

matt@groupcardmatt@groupcard

I am in the same spot right now.  Just wondering if there is any progress on this?