You need to sign in to do that
Don't have an account?
Permissionsets through apex code
Hi all,
I am trying to create Permissionsets from apex.I am able to create permission sets with object and field permissions enabled through apex. Any Idea how to create permissionsets with specific tab settings permissions enabled through apex code ?
Below is how I gave object and field permissions.
PermissionSet ps = new PermissionSet();
ps.Name = 'Test';
ps.Label = 'Test';
insert ps;
ObjectPermissions op = new ObjectPermissions();
op.parentId = ps.Id;
op.SobjectType = 'Account';
op.PermissionsCreate = true;
op.PermissionsRead = true;
insert op;
FieldPermissions fp = new FieldPermissions();
fp.parentId = ps.Id;
fp.SobjectType = 'Account';
fp.Field = 'Account.AccountSource';
fp.PermissionsRead = true;
fp.PermissionsEdit = true;
insert fp;
Please let me know if this code works:
PermissionSetAssignment psa = new PermissionSetAssignment(PermissionSetId = myPermissionSetId, AssigneeId = myAssigneeId); insert psa;
Best Regards
Naga Kiran
Hi Naga Kiran,
Thanks, but I am searching for something by which I can enable tab access to permissionset which I want to insert.
I found this - hope it helps
http://salesforce.stackexchange.com/questions/44176/tab-settings-not-available-on-permission-set