How to deactivate a portal user in Apex code?

How to deactivate a portal user in Apex code?

In 2021, it seems that attempting to update User.isActive in the same update operation that sets User.isPortalEnabled will actually cause the update operation to fail. When you set User.isPortalEnabled = false SFDC will automatically set User.isActive to false and User.ContactId to null, which is what we want.

How to remove the deactivate portal user in Perm?

1.Create a custom checkbox field called “Remove Perm Set Assignment Processing” that if set to true will be picked up in a scheduled flow to remove the Deactivate Portal User – Used in Flow permission set from the user. Go to Setup | Object Manager | User | Field & Relationships, create new.

How to deactivate a portal user in flow?

Create a text variable called “varUserHasPermSet” which if it holds a value means that the user is assigned the Deactivated Portal User – Used in Flow permission set. Create a formula called “PermissionSetIDFormula” which takes the Id from the Get the Permission Set Get Records element and removes the last 3 characters to make a 15 character Id.

How to deactivate a portal user in Salesforce?

Go to Setup | Permission Sets, click on the New button. This permission set will include the Ability to Deactivate a Portal User custom permission, the ability to View All Users and to Assign Permission sets. Best practice tip: Provide a description so you and other/future admins know what this permission set is used for.

How to identify is loged in user is a community user or portal user?

CSPLitePortal: user whose access is limited because he or she is an organization’s customer and accesses the application through aCustomer Portal. Label is High Volume Portal. CustomerSuccess: user whose access is limited because he or she is an organization’s customer and accesses the application through a Customer Portal.

Who is a label in a customer portal?

Label is High Volume Portal. CustomerSuccess: user whose access is limited because he or she is an organization’s customer and accesses the application through a Customer Portal. Label is Customer Portal User.