0

Use Case Creating visualforce page to conditionally render elements from various custom objects based on the user's permission set assignment. Currently, the visualforce page in use uses the rendered condition based on the user profile. The issue is that all users have the same base profile and that we differentiation application access using permission sets.

Here is a screenshot of the page enter image description here

Here is an example of what I am trying to do via the rendered condition (which would change the grid based on user permission set assignment):

apex:panelGrid columns="2" style="width:100%;" rendered="{!$User.Id == ObjectType.PermissionSetAssignment.Fields.AssigneeId && $ObjectType.PermissionSetAssignment.Fields.PermissionSetId == $ObjectType.PermissionSet.Fields.Id && $ObjectType.PermissionSet.Fields.Name == 'SOX Control Owner Permission Set' }"

c:GenericDataListComponent filter_p="Process_Owner__c='{!$User.Id}'" title="My Processes" objectName_p="SOX_Process__c" fieldSet_p="Dashboard_Regular_Process_FieldSet" pageSize_p="3" sortDirection_p="desc" orderByFieldName_p="LastModifiedDate" urlForNewRecord="{!URLFOR($Action.SOX_Process__c.New,null)}" hideButtons="true" />

c:GenericDataListComponent filter_p="Sub_Process_Owner__c='{!$User.Id}'" title="My Sub Processes" objectName_p="SOX_Sub_Process__c" fieldSet_p="Dashboard_Regular_SubProcess_FieldSet" pageSize_p="3" sortDirection_p="desc" orderByFieldName_p="LastModifiedDate" urlForNewRecord="{!URLFOR($Action.SOX_Sub_Process__c.New,null)}" hideButtons="true" />

/apex:panelGrid>"

Issue

When i access the screen above, it is blank. The conditions set forth in the Rendered statement do not carry through relationally across objects.

How should this be restructured? Is there a better way to do this without having to build a control class?

  • In cases where you do not want to show an element do they have access to that object? If not, use describe calls and check if they have access or not (in your controller). – Eric Jan 14 '15 at 17:25
  • Yes, they have access to all of the objects being presented within the VF page. This is simply a matter of presenting/displaying the objects elements that are most important to the users of a particular permission set. – gbolanis Jan 14 '15 at 17:43
0

We cannot use the global variable '$ObjectType' to get object's record data. It can be used to get objects and its fields metadata (schema details) only.

Please see http://www.salesforce.com/docs/developer/pages/Content/pages_variables_global_objecttype.htm

We can use global variable '$Setup' to access hierarchical custom settings which can be evaluated in 'rendered' attribute.

  1. Create a hierarchical custom settings (say Permissions__c)
  2. Create a custom field of type Checkbox in this custom setting (say SOX_Control_Owner_Permission_Set__c)
  3. Add the user to this custom setting

Update the rendered attribute as rendered="{!$Setup.Permissions__c.SOX_Control_Owner_Permission_Set__c}"

Please see http://www.salesforce.com/docs/developer/pages/Content/pages_variables_global_setup.htm

  • Did you create the hierarchical custom settings as mentioned in above pt 1 to pt3? If yes, please check the custom settings and its fields API name. – villsiva Jan 16 '15 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.