You need to sign in to do that
Don't have an account?
abhik dey 1
External User Freeze or Lock Out Issue
Hi,
I have to freeze or lock out an external user based on a custom logic. Once the custom logic condition sets to true, I need to freeze or lock out that user so that the user wont be able to login until the admin unfreeze or unlock that external user.
I tried with isPasswordlockout API field, but i got the error as 'Field is not re-writable' so I tried with freeze option but since when the user already logged in and the salesforce apex code or trigger runs in that user mode , i got the error "CANNOT SELF FREEZE" self frozen is not allowed.
My requirement is to lock or freeze that user when he performs some action and based on my custom logic , the user should be locked or freezed.
Also, I cant use the site.login method for 3 invalid attempts. So that option is gone apart from that anything is possible?
I tried with system.runas method but that works only in case of test method.
Any suggestions??
I have to freeze or lock out an external user based on a custom logic. Once the custom logic condition sets to true, I need to freeze or lock out that user so that the user wont be able to login until the admin unfreeze or unlock that external user.
I tried with isPasswordlockout API field, but i got the error as 'Field is not re-writable' so I tried with freeze option but since when the user already logged in and the salesforce apex code or trigger runs in that user mode , i got the error "CANNOT SELF FREEZE" self frozen is not allowed.
My requirement is to lock or freeze that user when he performs some action and based on my custom logic , the user should be locked or freezed.
Also, I cant use the site.login method for 3 invalid attempts. So that option is gone apart from that anything is possible?
I tried with system.runas method but that works only in case of test method.
Any suggestions??
I assume you tried setting UserLogin (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_userlogin.htm).IsFrozen when you got the "CANNOT SELF FREEZE" message.
You could try and find a way to switch the transaction user. Some options:
Use a future or batch method. This may encounter the same issue with the transaction user being the user you are trying to freeze.
Add the user record to a queue that will be frozen by a scheduled/batch job.
Use the API to perform the freeze as another user. See Freezing Users from Visualforce (http://bobbuzzard.blogspot.co.uk/2013/11/freezing-users-from-visualforce.html)