+ Start a Discussion
MarioCMarioC 

VF Newbie needs some help

OK.  I have spent hours trying to figure this out, so I thought I would post up and ask for some assistance.  To begin, I have not had any training other than Admin- no development training.  My company is not looking to spend money on training- so i need to figure it out myself.  Here is what I am doing-

I needed to create a dynamic section on an opportunity page.  I created it using VF and it looks like I want it, but I am having difficulties taking the next step.  I am using the standard opp controller on my new VF Opp page, and I added it to the layout of one of my page layouts using the new Spring 09 page layout tool.  When I do a Preview As..it comes up with a grey empty box where the VF form should be.  

 

Now I have been reading about Force ide and using Eclipse, but I think that is only used if I am not going to us the standardcontroller for opportunities.  

 

Am I missing anything?  I am going to keep trying to learn, but I would appreciate it if anyone can help me out.

I would like to know how to make it appear, because I think once I do that- the rest is pretty much done...

 

Thanks in advance for any assistance.

Message Edited by MarioC on 02-21-2009 04:11 PM
Best Answer chosen by Admin (Salesforce Developers) 
SteveAnderson41SteveAnderson41

MarioC, you can present different pages to different users. There's a recipe in the cookbook titled, "Overriding a Page for Some, but not All, Users" that should help you.

 

All Answers

mattdarnoldmattdarnold

You can use Eclipse / Force IDE to develop VF pages regardless of whether you're using a standard controller, a custom controller, or a standard controller and a controller extension.

 

Can you post your code -  it is hard to say otherwise what the issue is?

 

-- Matt

MarioCMarioC

Not a problem.  I was not sure if my issue was coding or not knowing the system well enough to know what I was doing.  Here is the code-

 

<apex:page standardController="Opportunity">
<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:commandButton value="Change Owner" action="{!URLFOR($Action.Opportunity.ChangeOwner,opportunity.id)}"/>
</apex:pageBlockButtons>
<apex:actionRegion >
<apex:pageBlockSection title="Opportunity Information" columns="2">
<apex:pageBlockSectionItem >
<apex:outputLabel value="Opportunity Owner"/>
<apex:outputField value="{!Opportunity.owner.name}"/>
</apex:pageBlockSectionItem>
<apex:inputField value="{!opportunity.name}" required="false"/>
<apex:inputField value="{!opportunity.accountID}" required="true"/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="End User"/>
<apex:inputField value="{!opportunity.EndAccount__c}"/>
</apex:pageBlockSectionItem>
<apex:inputField value="{!opportunity.Contact__c}" required="true"/>
<apex:inputField value="{!opportunity.Application_Name__c}"/>
<apex:inputField value="{!opportunity.Quote_Type__c}" required="true"/>
<apex:pageblockSectionItem >
<apex:outputLabel value="Product Family"/>
<apex:outputPanel >
<apex:inputField value="{!opportunity.Product_Line__c}" required="true">
<apex:actionSupport event="onchange" rerender="thePageBlock" status="status"/>
</apex:inputField>
<apex:actionStatus startText="applying changes..." id="status"/>
</apex:outputPanel>
</apex:pageblockSectionItem>
<apex:inputField value="{!opportunity.stagename}" required="true"/>
<apex:inputField value="{!opportunity.Product_Family__c}" required="false"/>
<apex:inputfield value="{!opportunity.Market_Focus__c}"/>
<apex:inputfield value="{!opportunity.Market_Specifics__c}"/>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Opportunity Description"/>
<apex:inputField value="{!opportunity.description}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:actionRegion>

<apex:pageblockSection columns="2" title="Opportunity Snapshot">
<apex:inputField value="{!opportunity.Annualized_Revenue__c}"/>
<apex:inputField value="{!opportunity.Reason_Won__c}"/>
<apex:inputField value="{!opportunity.TM_Probability__c}"/>
<apex:inputField value="{!opportunity.ReasonforLostOpportunity__c}"/>
<apex:inputField value="{!opportunity.CloseDate}" required="false"/>
<apex:inputField value="{!opportunity.Define_Other__c}"/>
<apex:inputField value="{!opportunity.Expected_PO_Date__c}"/>
<apex:inputField value="{!opportunity.Expected_PO_Location__c}"/>
<apex:inputField value="{!opportunity.Applications_Engineer__c}"/>
</apex:pageblockSection>

<apex:pageBlockSection columns="1" rendered="{!opportunity.Quote_Type__c == 'Custom Product'}">
<apex:pageBlockSection title="POP PADR Form" columns="2" rendered="{!opportunity.Product_Line__c == 'POP'}">
<apex:inputField value="{!opportunity.Dev_Solution__c}" required="false"/>
<apex:inputField value="{!opportunity.Application_Submitted__c}"/>
<apex:inputField value="{!opportunity.Fastener_Requested__c}"/>
<apex:inputField value="{!opportunity.Application_Description__c}"/>
<apex:inputField value="{!opportunity.Reason_for_Change__c}"/>
<apex:inputField value="{!opportunity.Present_Fastening_Method__c}"/>
<apex:inputField value="{!opportunity.Primary_Hole_Diameter__c}"/>
<apex:inputField value="{!opportunity.Primary_Side_Material__c}"/>
<apex:inputField value="{!opportunity.Secondary_Hole_Diameter__c}"/>
<apex:inputField value="{!opportunity.Secondary_Side_Material__c}"/>
<apex:inputField value="{!opportunity.Primary_Thick_in__c}"/>
<apex:inputField value="{!opportunity.Secondary_Thick_in__c}"/>
</apex:pageBlockSection>

<apex:pageBlockSection title="PK PADR Form" columns="2" rendered="{!opportunity.Product_Line__c == 'Parker-Kalon'}">
<apex:inputField value="{!opportunity.Dev_Solution__c}" required="false"/>
<apex:inputField value="{!opportunity.Application_Submitted__c}"/>
<apex:inputField value="{!opportunity.Fastener_Requested__c}"/>
<apex:inputField value="{!opportunity.Application_Description__c}"/>
<apex:inputField value="{!opportunity.Reason_for_Change__c}"/>
<apex:inputField value="{!opportunity.Present_Fastening_Method__c}"/>
<apex:inputField value="{!opportunity.Primary_Hole_Diameter__c}"/>
<apex:inputField value="{!opportunity.Primary_Side_Material__c}"/>
<apex:inputField value="{!opportunity.Secondary_Hole_Diameter__c}"/>
<apex:inputField value="{!opportunity.Secondary_Side_Material__c}"/>
<apex:inputField value="{!opportunity.Primary_Thick_in__c}"/>
<apex:inputField value="{!opportunity.Secondary_Thick_in__c}"/>
</apex:pageBlockSection>

<apex:pageBlockSection title="Helicoil PADR Form" columns="2" rendered="{!opportunity.Product_Line__c == 'Helicoil'}">
<apex:inputField value="{!opportunity.Dev_Solution__c}" required="false"/>
<apex:inputField value="{!opportunity.Application_Submitted__c}"/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Insert Requirements"/>
<apex:inputField value="{!opportunity.Fastener_Requested__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Insert Function Within Part"/>
<apex:inputField value="{!opportunity.Reason_for_Change__c}"/>
</apex:pageBlockSectionItem>
<apex:inputField value="{!opportunity.Present_Fastening_Method__c}"/>
<apex:inputField value="{!opportunity.Installation_Method_Tool__c}"/>
<apex:inputField value="{!opportunity.Method_for_Tapping__c}"/>
<apex:inputField value="{!opportunity.Parent_Material__c}"/>
<apex:inputField value="{!opportunity.Hole_Diameter__c}"/>
<apex:inputField value="{!opportunity.Boss_Diameter__c}"/>
<apex:inputField value="{!opportunity.Material_Thickness__c}"/>
<apex:inputField value="{!opportunity.Screw_Material__c}"/>
</apex:pageBlockSection>

<apex:pageBlockSection title="Dodge PADR Form" columns="2" rendered="{!opportunity.Product_Line__c == 'Dodge'}">
<apex:inputField value="{!opportunity.Dev_Solution__c}" required="false"/>
<apex:inputField value="{!opportunity.Application_Submitted__c}"/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Insert Requirements"/>
<apex:inputField value="{!opportunity.Fastener_Requested__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Insert Function Within Part"/>
<apex:inputField value="{!opportunity.Reason_for_Change__c}"/>
</apex:pageBlockSectionItem>
<apex:inputField value="{!opportunity.Present_Fastening_Method__c}"/>
<apex:inputField value="{!opportunity.Installation_Method_Tool__c}"/>
<apex:inputField value="{!opportunity.Parent_Material__c}"/>
<apex:inputField value="{!opportunity.Hole_Diameter__c}"/>
<apex:inputField value="{!opportunity.Boss_Diameter__c}"/>
<apex:inputField value="{!opportunity.Material_Thickness__c}"/>
<apex:inputField value="{!opportunity.Screw_Material__c}"/>
</apex:pageBlockSection>

<apex:pageBlockSection title="POP NUT PADR Form" columns="2" rendered="{!opportunity.Product_Line__c == 'POP NUT'}">
<apex:inputField value="{!opportunity.Dev_Solution__c}" required="false"/>
<apex:inputField value="{!opportunity.Application_Submitted__c}"/>
<apex:inputField value="{!opportunity.Fastener_Requested__c}"/>
<apex:inputField value="{!opportunity.Application_Description__c}"/>
<apex:inputField value="{!opportunity.Reason_for_Change__c}"/>
<apex:inputField value="{!opportunity.Present_Fastening_Method__c}"/>
<apex:inputField value="{!opportunity.Mating_Screw_Grade_Class__c}"/>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Parent Hole Diameter"/>
<apex:inputField value="{!opportunity.Primary_Hole_Diameter__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Parent Material"/>
<apex:inputField value="{!opportunity.Primary_Side_Material__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Mating Hole Diameter"/>
<apex:inputField value="{!opportunity.Secondary_Hole_Diameter__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Mating Material"/>
<apex:inputField value="{!opportunity.Secondary_Side_Material__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Parent Material Thickness"/>
<apex:inputField value="{!opportunity.Primary_Thick_in__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Mating Material Thickness"/>
<apex:inputField value="{!opportunity.Secondary_Thick_in__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlockSection>

<apex:pageBlockSection columns="2" title="Market Intelligence">
<apex:inputfield value="{!opportunity.Geography__c}"/>
<apex:inputfield value="{!opportunity.LeadSource}"/>
<apex:inputfield value="{!opportunity.Competitor__c}"/>
<apex:inputfield value="{!opportunity.Strategic_Business_Development__c}"/>
<apex:inputfield value="{!opportunity.Platform__c}"/>
<apex:inputfield value="{!opportunity.Annual_Usage__c}"/>
<apex:inputfield value="{!opportunity.Key_to_Winning__c}"/>
</apex:pageBlockSection>

<apex:pageBlockSection columns="2" title="Quotation">
<apex:inputfield value="{!opportunity.Quote_Request_Date__c}"/>
<apex:inputfield value="{!opportunity.Quote_Sent_Date__c}"/>
<apex:inputfield value="{!opportunity.Quote_Deadline__c}"/>
<apex:inputfield value="{!opportunity.Quote_Expiration_Date__c}"/>
<apex:inputfield value="{!opportunity.Quote_Number__c}"/>
<apex:inputfield value="{!opportunity.Date_Stage_Closed__c}"/>
</apex:pageBlockSection>

<apex:pageBlockSection columns="2" title="Opportunity Progression Notes">
<apex:inputfield value="{!opportunity.Samples_Required__c}"/>
<apex:inputfield value="{!opportunity.Sample_Order_Date__c}"/>
<apex:inputfield value="{!opportunity.ProgressNotes__c}"/>
<apex:inputfield value="{!opportunity.Sample_Qty__c}"/>

</apex:pageBlockSection>

<apex:pageBlockSection columns="2" title="SFDC Systems Data">
<apex:inputfield value="{!opportunity.Probability}" required="false"/>
<apex:inputfield value="{!opportunity.Lost_OP__c}"/>
<apex:inputfield value="{!opportunity.OP_Global_Sector__c}"/>
</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>
</apex:page>
mattdarnoldmattdarnold

Does the user you're previewing as have permissions to view the VF page you're adding to the page layout?

 

Also, are you trying to embed this page within your page layout or have it take the place of your page layout entirely?

 

-- Matt

MarioCMarioC

I am logged in as the System Admin and I verified that I have rights to view the page.  I am currently embedding the VF page, but I would prefer to simply replace the OPP page all together.  I saw that with the new spring release it displayed VF pages as an option to add to the layout, so I was just trying to get it working one way or another.

 

Thanks again Matt.

MarioCMarioC
If I could not embed the whole page, I was going to try and create a layout and change the VF page to only have the area that was dynamic.  So the whole page would pretty much be non-vf.
MATTYBMEMATTYBME

For the VF page to be the Opportunity page (I am assuming this is for a Opportunity Details page?) you need to override the View. To do this goto Setup>Customize>Opportunities>Buttons and Links and Override the View usin Content Type: Visualforce and select the VF page you have created.

 

(Sorry. Reviewing your code you want this on Edit and potentially New, so override those)

 

I would not recommend that you embed your VF page inline in the Opportunity Page layout as it seems rather long.

 

 

Message Edited by MATTYBME on 02-23-2009 07:59 AM
MarioCMarioC
Thanks Matt.  That was the piece that I have been missing.... Everything I have read on VF pages is on creation, but I could never find info on using it.  I have one question on this.  We have two seperate offices that use SFDC and each office has therir own configurations (different roles, different record types, etc).  Would overriding the Opportunity effect all users, or would the other office still be able to have their own configs?  I really want these changes to apply to our group and not the other (European) group.
MATTYBMEMATTYBME

Mario,

 

Unfortunately it seems right now that the only behavior on button and Links Override is that it becomes the default functionality. There is not the current possibility to override for specific profiles, users or record types.

 

All that to say if you do override any button it will become an org wide override.

 

I have posted an Idea about the need to allow profile specific overrides: Idea Post

MarioCMarioC
Eww... So does that mean I am better off trying to embed the rendered section of my VF and use the standard layout tools for the rest?
MATTYBMEMATTYBME

You can try but I would not recommend it. It will potentially make the page look messy. If you do add the VF page inline on a Page Layout make sure that you update your profiles with the inclusion of the VF page (if you look at a profile you will see at the bottom a section called:Enabled Visualforce Page Access)

Include your VF page here.

MarioCMarioC
Overwriting will override the default page layout for Opportunities.  But I do not think that anyone uses the default page.  We all have our own custom page layouts for each site.  Does that mean that this will not affect our other office? 
SteveAnderson41SteveAnderson41

MarioC, you can present different pages to different users. There's a recipe in the cookbook titled, "Overriding a Page for Some, but not All, Users" that should help you.

 

This was selected as the best answer
MATTYBMEMATTYBME
Thanks for the prompt Steve. A good solution if you want to override for particular profiles. Shame there is not standard function to allow the override at the profile level.
MarioCMarioC
Thanks guys.  This is exactly what I needed.  I will keep this thread updated with my status.
MarioCMarioC

OK. So I was able to add the overrides for new and edit Opportunities.  I do have a couple more questions-

 

1. Because I am setting up a section in my Opp form that is rendered based on a few entries, I will need something similar as a view.  I have gone through and tried to create another VF page that uses outputText instead of inputfield, but that does not seem to work like I would like.  Can someone point me in the direction of a place where I can find an example of an view only page that is also inline edittable. 

 

2. I would like to add a few Related Lists to the end of my Opp view page as well, but I cannot seem to find the syntax.  We use 4-5 different related lists fields on our opps- Notes & Attachments, Open Activities, Activity History, Stage History and Approval History.

 

 

Once again, your help is much appreciated.

SteveAnderson41SteveAnderson41

You wrote,



Can someone point me in the direction of a place where I can find an example of an view only page that is also inline edittable. 


 

I don't understand what you are asking for.  View only and edittable seem contradictory.

 


2. I would like to add a few Related Lists to the end of my Opp view page as well, but I cannot seem to find the syntax.  We use 4-5 different related lists fields on our opps- Notes & Attachments, Open Activities, Activity History, Stage History and Approval History.


 

You can use describeLayout to find the name value for relatedlists.  A quick way to do that is to use the Ajax Toolkit.  See the Ajax Toolkit Developer's Guide

 

 

 

MarioCMarioC
Sorry for the confusion.  I want to have the view opportunity look the same as the default opportunity view.  The whole form is not in edit mode, but you can then double-click on a value to edit it...  does that make more sense?
MarioCMarioC

I got my related lists all set, it was just using the correct syntax-

<apex:relatedList list="ProcessSteps" ></apex:relatedList>
<apex:relatedList list="NotesAndAttachments" ></apex:relatedList>
<apex:relatedList list="OpenActivities" ></apex:relatedList>
<apex:relatedList list="ActivityHistories" ></apex:relatedList>

 

1 down, 1 to go.

SteveAnderson41SteveAnderson41

Glad you got your related lists working.

 

Regarding your other request - what you want is inline editing.  Visualforce doesn't have "out of the box" support for this.  Some people have used events (like "ondblclick") to mimic inline editing.  You could do a search for "inline editing" on the forum to find out various solutions.