I was working over my custom visualforce page where I am displaying some fields including picklist field , text fields etc. Values filled in these fields are used as a search criteria to fetch records from my organization. There were around 30 picklist fields on this page.
Everything was working fine then I suddenly recognize that this search can be used by all users of my application. Then I logged in as user of different profile other than system admin. Pretty amazing for me that most of the picklist and text fields were not visible, then I jumped into the field level security of my object and found that these fields are not visible to this profile. I traversed back to my visualforce page where I saw that I have used input fields to display picklist and text fields. I changed all text inputFields to inputText but it was very difficult to create 30 select list after describing all picklist values from object.
So I have create a component in which we will pass Object API name and Field API name and drop down will be created with all values of that picklist.
Now how to use this component :
1) Get the component downloaded from app exchange : http://bit.ly/liFjUf
2) Install this package to your organization : http://bit.ly/mgPpaq
3) Now create a visualforce page and class code is provided below :
Apex :
objectName (Required) : API Name of Object
picklistFieldAPI(Required) : API Name of picklist value
useDefaultValue(Optional) : True (--None-- will be displayed) , False (Only picklist values will be shown)
Feedbacks are always welcomed, also please let me know if there is any problem.
Cheers
Everything was working fine then I suddenly recognize that this search can be used by all users of my application. Then I logged in as user of different profile other than system admin. Pretty amazing for me that most of the picklist and text fields were not visible, then I jumped into the field level security of my object and found that these fields are not visible to this profile. I traversed back to my visualforce page where I saw that I have used input fields to display picklist and text fields. I changed all text inputFields to inputText but it was very difficult to create 30 select list after describing all picklist values from object.
So I have create a component in which we will pass Object API name and Field API name and drop down will be created with all values of that picklist.
Now how to use this component :
1) Get the component downloaded from app exchange : http://bit.ly/liFjUf
2) Install this package to your organization : http://bit.ly/mgPpaq
3) Now create a visualforce page and class code is provided below :
Apex :
public class TestPicklistController { //Property to hold the selected value of component public String SelectedVal {get; set;} public TestPicklistController() { SelectedVal = '' ; } public void simpleDebug() { System.debug(':::::::: ' + selectedVal) ; } }Visualforce :
<apex:page controller="TestPicklistController"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Check Selected Value" action="{!simpleDebug}" /> </apex:pageBlockButtons> <apex:outputLabel value="Industry"/> <arora:PicklistToPicklist value="{!SelectedVal}" objectName="Account" picklistFieldAPI="Industry" useDefaultValue="true" /> </apex:pageBlock> </apex:form> </apex:page>Value (Required) : Selected Picklist Value
objectName (Required) : API Name of Object
picklistFieldAPI(Required) : API Name of picklist value
useDefaultValue(Optional) : True (--None-- will be displayed) , False (Only picklist values will be shown)
Feedbacks are always welcomed, also please let me know if there is any problem.
Cheers