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
cooldamselcooldamsel 

How to assign permission sets to user programmatically in visual force page?

Hi,

I am a newbie in salesforce. Please help me on this.

I have a visualforce page where i choose certain conditions and display the users. How should i assign permissions set to the selected users programmatically?

Can anyone please help me out..

Thanks in advance.

Regards,
Indhu
Sonam_SFDCSonam_SFDC
Hi Indhu,

I believe you can query on the PermissionSet and PermissionsetAssignement Objects to get a user assigned to a permission set:
The links beLow explains how you can assign a new permission set to a user:

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_permissionset.htm
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_permissionsetassignment.htm
Sure@DreamSure@Dream
Hi,

You can use PermissionsetAssignment and Permissionset objects.
 
PermissionsetAssignment object contains PermissionSetId and AssigneeId fields.You can assign values to those fields and insert the record.

Thanks