+ Start a Discussion
MarioCMarioC 

Starting again from Scratch... a little long winded, but please help.

OK.  After months of trying to learn VF and Apex, I am starting to look at everything I did and I think I may have just complicated my life immensly.  I think I started with trying to do one thing, then that led to having to do this other thing and before you know it- things are starting to get really complex for me.  So I wanted to get a fresh take on what I am trying to do and I hope someone might help me with determining if I am on the right path or if I should start over from scratch.

 

Here is what I am trying to do and then I can say what I have done to date.  Just as a quick note- we use SFDC in US and UK, but we have different record types, page layouts, roles and profiles for both groups.

 

 

1. I need to re-create an Opp page layout so that if there are two specific fields selected, that a page section is shown with new fields (here are 5 possible variations of the same section). 

 

What I did-

I created a VF page that uses the render feature to add the section I need (code provided at the end of this posting).  That looks like it works for me, until I tried to implement it.  I cannot simply override the New/Edit/View buttons with it since we have the UK division that will not use this.  So I went and followed the cookbook on "how to override a page for some, but not all" and that worked to get the people to the VF page, but I cannot seem to get the rest of the users to hit the other OPP form- it only comes up blank (might just need to do more research on it, but the cookbook says it stays on the same page, which I would have thought would be the users standard page layout). 

2.  Would like to have the new VF page view override to be inline editable as the standard OPP form is out of the box, but there are going to be different sections that appear on the form based on the fields from part 1.  I think VF pages in view mode cannot be inline edittable (or so I read somewhere), so this might not be something I can do with VF.  Can I write some Apex code to select the pagelayout according to the fields that I have in part 1?

 

What I did-

I have gone and created a VF page with only OutputText fields so that the values can be seen, but the rendering piece is what I am not sure of.  How to render when you are in view mode and not edit mode. 

3. When viewing a contact, if I scroll to the related lists sections for Opps, and select New Opportunity- it opens the VF page but does not carry over the account and contact info from the contact I was in.  Is it possible to do this?

 

What I did- nothing yet..  just starting to look around

 

 

So, I have had no training on development, but I have been able to piecemail something that is somewhat working, but am I going after it in the correct way? 

Should I look to continue down the path, or should I look to use different page layouts instead of a VF page?  I probably am more comfortable using page layouts rather than VF, but can I do what I need with that?

 

I thank you for reading this long winded message and appreciate any feedback...  below is the VF page code that I am using for my new/edit Opp.

 

*The code is too long to add here, so you can see the code by going to this post- http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=10202&page=1

Best Answer chosen by Admin (Salesforce Developers) 
MarioCMarioC
Simple workflow rules got it working for me...  record types is the way to go...

All Answers

MarioCMarioC
I am also looking at doing this by record type.  I created the different record types and defaulted the page layouts, now I need to figuure out how to change the record types when certain values are present in an Opp.
MarioCMarioC
Simple workflow rules got it working for me...  record types is the way to go...
This was selected as the best answer