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
Anand_agrawal@persistent.co.inAnand_agrawal@persistent.co.in 

Rendering the pageblock dynamically

Hi,

 

I am using the spring 11 fieldset feature to display the fields in a pageblock using dynamic binding. based on the fieldset size I am hiding/displaying the pageBlock. if fieldset size is 0 (zero) then pageblock will not be rendered otherwise it will.

 

However if fieldset is having any field which is not accessible to loggedin user then fieldset returns the size as no. of fields in fieldset irrespective of whether those fields are accessible or not.

 

My requirement is to hide the pageBlock if none of the fields in fieldset are accessible to logged user.

 

Can you please give me some pointer how can I archive this ?

 

Thanks,

Anand Agrawal.

Best Answer chosen by Admin (Salesforce Developers) 
Anand_agrawal@persistent.co.inAnand_agrawal@persistent.co.in

Thanks for the reply.

 

I have got the work around for this. So there is property associated with field called "accessible" when we access it using fieldset, which tells us whether the logged-in user has the access to that particular field or not. This property I used while loading of the page and set a JavaScript variable to false is there is none of the field is accessible to logged-in user.

 

Then after loading of the page I manually set the display:none CSS property for that particular pageBlock if JavaScript variable is false.

 

 

Thanks anyway.

Anand Agrawal.

All Answers

sfdcfoxsfdcfox

I don't think that you can do this, at least not easily. You'd have to check the user's field permissions in the controller, and then adjust the fieldset's contents to not include fields that they can't access.

Anand_agrawal@persistent.co.inAnand_agrawal@persistent.co.in

Thanks for the reply.

 

I have got the work around for this. So there is property associated with field called "accessible" when we access it using fieldset, which tells us whether the logged-in user has the access to that particular field or not. This property I used while loading of the page and set a JavaScript variable to false is there is none of the field is accessible to logged-in user.

 

Then after loading of the page I manually set the display:none CSS property for that particular pageBlock if JavaScript variable is false.

 

 

Thanks anyway.

Anand Agrawal.

This was selected as the best answer