2

I was hoping I could get some help creating an inline visualforce page on my Opportunity page layout.

The purpose of this page would be to display instructions to the sales rep based on the opportunity's current stage. And then when the opportunity stage changes, the content of the inline visual force page would change and display the new instructions for the new stage selected.

Example:

First opportunity stage = Sales Qualified Lead

Inline visualforce page would display static text specific to the Sales Qualified Lead stage. Something like this:

1) Make sure you walk them through the standard checklist document (html link to doc on intranet) 2) Make sure you review the ABC document with them (html link to doc on intranet)

Then when the sales rep moves the opportunity to the next stage:

Second opportunity stage = Needs Analysis

The visualforce page's content changes and shows them a new set of instructions based on the Needs Analysis stage. Something like:

1) Complete the company overview presentation with them (link to PPT on intranet) 2) Demonstrate our our reporting functionality (link to doc)

And then the rest of the opportunity stages would work just like the above, each with specific instructions based on the stage.

As the sales rep progresses through our sales process and changes the sales stage they always have instructions on what they're supposed to be doing during that stage of our sales process.

I'm brand new to visualforce (watching the introduction to visualforce pages video now - lol) and would be very grateful if someone could give me the basic building blocks to do what I'm trying to do here and then I could take it from there.

Thank you!

  • Ken

1 Answer 1

3

This can be accomplished fairly easily with VF and Apex. While you could hard code the rules in the Apex controller, I would suggest carrying your rules in either a custom setting or custom object.

Assuming you want to carry the rules a custom object, where you create a record for each stage. This record carries the stage name in a field and the instructions for that stage in a field. If you create this object, you can do something like this...

Controller

public class OppInstructionsController {

    public Opportunity opp                                              {get;set;}
    public list<OpportunityRules__c> myRules                            {get;set;}
    public map<string,string> stage2Instructions                        {get;set;}
    public string StageInsructions                                      {get;set;}      

    public OppInstructionsController(ApexPages.StandardController controller){
        this.opp= (Opportunity)controller.getRecord();
        myRules = [Select Id, StageName, Instructions__c From OpportunityRules__c]; 
        for(OpportunityRules__c rule : myRules){
            stage2Instructions.put(rule.StageName, rule.Instructions__c)
        }

        StageInstructions = stage2Instructions.get(this.opp.StageName);                 
    }       
}

VF Page

<apex:page StandardController="Opportunity" extensions="OppInstructionsController">

    <apex:outputText value="{!StageInstructions}"/>

</apex:page>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .