You need to sign in to do that
Don't have an account?
Zack Thomas
Run code at login
I'm attempting to run code when a user logs in to check for overdue opportunities and then create a task and reminder to let the user know. My first thought was to create a trigger on the User object and check for differences in the LastLoginDate field, but this doesn't seem to work. I can see the field updating as it should, and the trigger runs and checks when doing an explicit update to user fields through Setup, but nothing seems to get run on login.
Any ideas?
There's no login event that you can use to run backend code.
Rather than going through a convoluted event > trigger > task path, what if you created a custom Visualforce home page that just queries and displays a list of overdue opportunities?
I misspoke a bit, but the general idea still holds. You can't change the Home tab, but you can use your Visualforce page as the default tab in place of Home:
1. Create a Visualforce page
2. Create a custom Visualforce Tab for that page
3. Edit your App(s) to (a) add the new tab and (b) set the tab as the Default Landing Tab
When users log in, they will see your new tab first (but the existing Home tab will still be available).
You can always create a homepage component that iframes a 0-pixel vf page which does the check in the underlying controller. Depending on the outcome that first VF page could then conditionally render some javascript window.open magic that would pop up a second VF page which would actually show the items you want.
That way everybody will be happy, including your admin :smileyhappy:
D.