You need to sign in to do that
Don't have an account?
agethunt
hiding a field in pagelayout
i want to hide a field on the pageloaut depending upon the user. any help . i dont want to cretae any ne w pagelayot . in case it needs some javascript function help then let me know
In your normal pagelayout , you can hide fields using Field Level Security..
You will find "Set field level security" button when you view the details of a Field...
Is this what you're looking for? or you want to hide a field in a visualforce page....
Ok... But unfortunately you cannot embed a visualforce form or javascript into your normal page layout..
But you can very well create your own Visualforce Page...
There is a rendered attribute while you add fields to your visualforce page.. You can possible add any condition in this attribute (be it based upon user or anything)
Scenario 1 as well as 2 can be achieved using this.. Let me know if you need any help to get started
Yes .. you can defenitely do it.. But my suggestion would be
1) Create a visualforce page with a standardcontroller
2) Use the rendered attribute and rerender attributes as far as possible..
If required use an extension
<apex:page standardcontroller="Campaign"> <apex:form > <apex:sectionHeader title="Create Campaign" subtitle="Create new Campaign"/> <apex:pageblock > <apex:pageBlockSection title="Campaign Information" columns="1"> <apex:inputfield value="{!Campaign.Name}" rendered="{!IF (CONTAINS($User.Alias, Smith) True, False)}"/> </apex:pageblocksection> </apex:pageblock> </apex:form> </apex:page>
Now, the Campaign name field will be displayed only if the current logged in User's alias name is "Smith"..
Hi u can use the VisualForce DynamicPage Edit for the same where u can render few fields on the basis of the value that has been selected.
Rendering can be done on Picklist or checkbox or Button depending on the requirement.
Binding error are because there may be mismatch in the fields and the ids.
I am giving u the code for the same.
U can try the code for the Opportunity Object here u need to create two custom fields reason lost and competitor
<apex:page standardController="Opportunity" sidebar="false"> <apex:sectionHeader title="Edit Opportunity" subtitle="{!opportunity.name}"/> <apex:form > <apex:pageBlock title="Edit Opportunity" id="thePageBlock" mode="edit"> <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:actionRegion > <apex:pageBlockSection title="Basic Information" columns="1"> <apex:inputField value="{!opportunity.name}"/> <apex:pageBlockSectionItem > <apex:outputLabel value="Stage"/> <apex:outputPanel > <apex:inputField value="{!opportunity.stageName}"> <apex:actionSupport event="onchange" rerender="thePageBlock" status="status"/> </apex:inputField> <apex:actionStatus startText="applying value..." id="status"/> </apex:outputPanel> </apex:pageBlockSectionItem> <apex:inputField value="{!opportunity.amount}"/> <apex:inputField value="{!opportunity.closedate}"/> </apex:pageBlockSection> </apex:actionRegion> <apex:pageBlockSection title="Closed Lost Information" columns="1" rendered="{!opportunity.stageName == 'Closed Lost'}"> <apex:inputField value="{!opportunity.competitor__c}" required="true"/> <apex:inputField value="{!opportunity.Reason_Lost__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
I have used the same code for rendered the textboxes based on the checkbox selection in the code below.
For the page to execute Create an Object CustomerFinancialDetails
with the fields are mentioned in the code
<apex:page standardController="Customer_Financial_Details__c" tabStyle="Customer_Financial_Details__c"> <apex:form > <apex:pageBlock title="Customer Financial Detail Edit" id="thePageBlock"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:actionRegion > <apex:pageBlockSection title="Liabilities" columns="2"> <apex:pageblockSectionItem > <apex:outputLabel value="Vechile Loan"/> <apex:outputPanel > <apex:inputCheckbox value="{!Customer_Financial_Details__c.Vechile_Loan__c}" id="theCheckbox"/> <apex:actionSupport event="onclick" rerender="thePageBlock" status="status"/> <apex:actionStatus startText="Please wait......." id="status"/> </apex:outputPanel> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputLabel value="Personal Loan"/> <apex:outputPanel > <apex:inputCheckbox value="{!Customer_Financial_Details__c.Personal_Loan__c}" id="theCheckbox"/> <apex:actionSupport event="onclick" rerender="thePageBlock" status="status"/> <apex:actionStatus startText="Please wait......." id="status"/> </apex:outputPanel> </apex:pageblockSectionItem> </apex:pageBlockSection> </apex:actionRegion> <apex:pageBlockSection title="Vechile Loan" columns="2" rendered="{!Customer_Financial_Details__c.Personal_Loan__c == true}"> <apex:pageblockSectionItem > <apex:outputLabel value="Vehicle loan monthly EMI"/> <apex:inputfield value="{!Customer_Financial_Details__c.Vehicle_loan_monthly_EMI__c}"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputLabel value="Total No of Years Of Loan"/> <apex:inputfield value="{!Customer_Financial_Details__c.Total_no_of_years_of_vehicle_loan__c}"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputLabel value="Total No of Years Pending"/> <apex:inputfield value="{!Customer_Financial_Details__c.Total_no_of_years_pending_for_vehicle__c}"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputLabel value="Year of final payment date"/> <apex:inputfield value="{!Customer_Financial_Details__c.Year_of_final_payment_date__c}"/> </apex:pageblockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Personal Loan" columns="2" rendered="{!Customer_Financial_Details__c.Vechile_Loan__c == true}"> <apex:pageblockSectionItem > <apex:outputLabel value="Personal loan monthly EMI"/> <apex:inputfield value="{!Customer_Financial_Details__c.Vehicle_loan_monthly_EMI__c}"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputLabel value="Total No of Years Of Loan"/> <apex:inputfield value="{!Customer_Financial_Details__c.Total_no_of_years_of_vehicle_loan__c}"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputLabel value="Total No of Years Pending"/> <apex:inputfield value="{!Customer_Financial_Details__c.Total_no_of_years_pending_for_vehicle__c}"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:outputLabel value="Year of final payment date"/> <apex:inputfield value="{!Customer_Financial_Details__c.Year_of_final_payment_date__c}"/> </apex:pageblockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>