+ Start a Discussion
GRSOLISGRSOLIS 

Delete Users

Hello!

 

I wanted to know if it's possible to delete users, I don't see the option in the web user interface, and when using the API (I'm using the Mule Cloud Connector for Salesforce) I receive the message INSUFFICIENT_ACCESS_OR_READONLY even when my user is Admin.

Thanks!

 

German.

Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

No You can not delete user but you can perform two things

 

1)Deactivate User : For this you set "IsActive" field on User objet as false

   IsActive : Indicates whether the user has access to log in (true) or not (false). You can modify a User's active status from the Salesforce user interface or via the API.

 

Ex : 

 

User u = [Select id from user where id =: userID; //userId is variable which has the id of user to be deactivated

 

 

 

2)Disable user : This option is only for portal users.You can disable a portal user by setting "IsPortalEnabled" as false. Ths will delink aportal user from contact.

 

IsPortalEnabled : Indicates whether the user has access to the partner portal or Customer Portal (true) or not (false).

 

You might have to use higher version of class to use IsPortalEnabled field of user.

All Answers

Ankit AroraAnkit Arora

You can not delete the user. In fact you can deactivate the user.

 

 

Thanks
Ankit Arora

 

Shashikant SharmaShashikant Sharma

No You can not delete user but you can perform two things

 

1)Deactivate User : For this you set "IsActive" field on User objet as false

   IsActive : Indicates whether the user has access to log in (true) or not (false). You can modify a User's active status from the Salesforce user interface or via the API.

 

Ex : 

 

User u = [Select id from user where id =: userID; //userId is variable which has the id of user to be deactivated

 

 

 

2)Disable user : This option is only for portal users.You can disable a portal user by setting "IsPortalEnabled" as false. Ths will delink aportal user from contact.

 

IsPortalEnabled : Indicates whether the user has access to the partner portal or Customer Portal (true) or not (false).

 

You might have to use higher version of class to use IsPortalEnabled field of user.

This was selected as the best answer
GRSOLISGRSOLIS

Great, thanks a lot, you have been of big help to me.

 

Best regards!

German

Shashikant SharmaShashikant Sharma

Your welcome :)

Sanchivan SivadasanSanchivan Sivadasan

Hi there,

 

I am having the same issue. I am trying to update the IsPortalEnabled field to false and but for some reason it reverts back to True. I am doing this within a test method. I just posted a question on the forum with all the code details. You can find it here: http://boards.developerforce.com/t5/Apex-Code-Development/Customer-Portal-Disabling-User-and-Setting-Account/td-p/622769

 

Hope you would be able to help. Thank you.

 

Sanch S.

Praveen Jha 18Praveen Jha 18
Sorry, this page doesn't exist.