Home > logout > Insert a record in custom object on User Logout

Insert a record in custom object on User Logout

June 12Hits:0
Advertisement

I want to insert a record in custom object whenever a user logout from the salesforce. Is there any thing available to track this and create a record as soon as user logouts?

Answers

There is no possible event based approach as far as I know. The closest thing I can think of is this.

SELECT Id,EventType,LogFile,LogDate,LogFileLength
FROM EventLogFile WHERE EventType='Logout'

Trial:

I tried to put a afterInsert Trigger on EventLogFile like below:

if(eventLogFile.EventType == 'Logout')
    // Create new record

But it will raise an error:

SObject type does not allow triggers: EventLogFile

Solution:

Instead poll on a scheduled frequency for the EventLogFile for Logout EventType through REST API and create the custom records. This document might help you implement the same

Tags:logout

Related Articles

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.598 s.