You need to sign in to do that
Don't have an account?
Kbhaskar
apex code to update permission sets
hi,
i'm trying to update permission set from apex code but still it's not working can anyone help me out !
i'm trying to update permission set from apex code but still it's not working can anyone help me out !
String parameterValue = ApexPages.currentPage().getParameters().get('Permission_Set_ID'); //Permission_Set_ID from the URL for reference } } } public pagereference Assign() //assign of user difend permissions { if(selectedValue == 'readselected') { //update Object permission for Opportunity PermissionSet ps =[select id,ProfileId,SystemModstamp,UserLicenseId FROM PermissionSet where id='parameterValue ']; ObjectPermissions op = new ObjectPermissions(); op.parentid = ps.id; op.SobjectType = 'Opportunity'; op.PermissionsCreate = false; op.PermissionsRead = true; op.PermissionsEdit = false; insert op; } return null; } }
Please change your query as shown below and your code will work correctly:
Here, "parameterValue" is a variable, so you have to use =: syntax for it in SOQL query.
Hope it helps you.
Thanks,
Prashant
Anup ,Prashant it's still not working as expected i have changed as per your syntax but still the premission set is not updating .below is my code would you please check this out !
apex code
vf page