You need to sign in to do that
Don't have an account?
Kbhaskar
apex code to update Field permission sets
hi,
i'm trying to update Field permission set from apex code but still it's not working can anyone help me out !
Error: Compile Error: Method does not exist or incorrect signature: [List<FieldPermissions>].put(Integer, String)
i'm trying to update Field permission set from apex code but still it's not working can anyone help me out !
Error: Compile Error: Method does not exist or incorrect signature: [List<FieldPermissions>].put(Integer, String)
String parameterValue = ApexPages.currentPage().getParameters().get('Permission_Set_ID'); //Permission_Set_ID reference from URL } } //update field permission for Opportunity permission fieldpermissions fp=new fieldpermissions(); list<fieldpermissions>rt=[select id FROM fieldpermissions where parentid=:parameterValue AND SobjectType='Opportunity' ]; rt.put(1,parameterValue ); if(!rt.isempty()) { fp.id=rt[0].id ; }else{ rt.parentid = parameterValue ; rt.SobjectType ='Opportunity'; } for(wrapper i:lstwrapperIntString) { if(i.selectedread ==true){ //vf page if selected read rt.PermissionsRead= true; } if(i.selectedwrite ==true){ rt.PermissionsEdit=true; rt.PermissionsRead= true; } upsert rt; } return null; } }
but if I'm wrong,please bare with me.
You are using put method on a list that is why you are getting error becuase put is not a method of List.
put method is used with the maps.
So either you change your method to add in place or put or you have to use map in place of list.
If you want to use List than change your code as follows :
Let me know if you have any issue or you need more help on this.
Thanks,
Abhishek