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
Mariam Ibrahim 10Mariam Ibrahim 10 

How can I ensure my apex trigger fires only when a user session is timed out?

Hi,
I have an apex code that is working perfectly but I want the trigger to only fire when a user logs out/ timesout out his/her session, how can I make that work?

Thanks,
Mariam
Raj VakatiRaj Vakati
I don't think so you can able to do it with trigger directly. But what I am suggesting is try to use Apex Transaction Security Policies on the session and use the logic there.

Refer this link 

https://help.salesforce.com/articleView?id=security_transactions_apex_policies.htm&type=0