• Jason Paine
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
I have a header page that I want to include on serveral pages.
This header has info such as name, phone,email, etc.

The other pages lead a user through a series of questions similar to a visual workflow.
As they go along the user may need to edit fields on either form.

If I edit data on the included header page then press a save button on the main pag;
my data is not saved back to the database.  or vice versa.

If a user enters or changes data on either the main page or the included page I want to be able to save data to both pages with one button click


I know I could copy and paste the code from the header page into all of my pages but would prefer not to do that.
As we may need to make changes to the header fields and I do not want to have edit  every page everytime we want to make a change.

I am including striped down versions of my pages and extension.
I tried to use apex:actionSupport to fire a save action on my main page but that did not work.

Any help or guidence would be great.

------------------exHeader Page-----------------------------------------
<apex:page standardController="Lead" extensions="exMyLeadExtension">
    <apex:form >
   
     <apex:pageBlock title="Demographics" mode="detail">
        <apex:pageBlockSection columns="3">
                <apex:inputField value="{!Lead.FirstName}"/>
                <apex:inputField value="{!Lead.LastName}"/> 
                <apex:inputField value="{!Lead.Phone}"/>
                <apex:inputField value="{!Lead.MobilePhone}" style="width:100px"/>
                <apex:inputField value="{!Lead.Email}" style="width:100px" />
           </apex:pageBlockSection>
   
    <apex:pageBlockButtons location="Bottom" >
        <apex:commandButton id="saveButtonHeader" action="{!quicksave}" value="Save" />
    </apex:pageBlockButtons>
       
</apex:pageBlock>
       
    </apex:form>
</apex:page>

------------------exPage1 Page-----------------------------------------
<apex:page standardController="Lead" extensions="exMyLeadExtension" docType="html-5.0" title="Page1">
<apex:include pageName="exHeader"/>
<apex:actionSupport event="onClick"
                    action="{!quickSave}"
                    rerender="Page1"/>
                           
<apex:form >
    <apex:pageBlock id="Page1" title="Page 1" mode="detail">
        <apex:pageBlockSection >
                <apex:inputField value="{!Lead.Street}" style="width:200px" />
                <apex:inputField value="{!Lead.City}" style="width:100px" />             
        </apex:pageBlockSection> 
       
    <apex:pageBlockButtons location="Bottom" >
        <apex:commandButton id="saveButtonPage1" action="{!quicksave}" value="Save" />
        <apex:commandButton id="nextPage2Button" action="{!nextPage2}" value="Save go Page2" />
    </apex:pageBlockButtons>
     
    </apex:pageBlock>          
    </apex:form>
</apex:page>

------------------exPage2 Page -----------------------------------------
<apex:page standardController="Lead" extensions="exMyLeadExtension" docType="html-5.0" title="Page2">
<apex:include pageName="exHeader"/>
<apex:actionSupport event="onClick"
                    action="{!quickSave}"
                    rerender="Page2"/>
                           
<apex:form >
    <apex:pageBlock id="Page2" title="Page 2" mode="detail">
        <apex:pageBlockSection >
                <apex:inputField value="{!Lead.State}" style="width:100px" />
                <apex:inputField value="{!Lead.PostalCode}"  style="width:100px" />
        </apex:pageBlockSection> 
       
    <apex:pageBlockButtons location="Bottom" >
        <apex:commandButton id="saveButtonPage2" action="{!quicksave}" value="Save" />
        <apex:commandButton id="nextPage1Button" action="{!nextPage1}" value="Return to Page1" />
    </apex:pageBlockButtons>
     
    </apex:pageBlock>          
    </apex:form>
</apex:page>

------------------exMyLeadExtension Extension-----------------------------------------
String name;
    Boolean showGreeting = false;
   
    private final Lead lead;
   
    // The extension constructor initializes the private member
    // variable acct by using the getRecord method from the standard
    // controller.
    public exMyLeadExtension(ApexPages.StandardController stdController) {
        this.lead= (Lead)stdController.getRecord();
      
       
    }
 
    public PageReference nextPage1() {
        update lead;
        PageReference pageRef= Page.exPage1;
        pageRef.setRedirect(true);
        pageRef.getParameters().put('id',Lead.id);
        return pageRef;
    }
     
  public PageReference nextPage2() {
        update lead;
        PageReference pageRef= Page.exPage2;
        pageRef.setRedirect(true);
        pageRef.getParameters().put('id',Lead.id);
        return pageRef;
    }
   

}

Trying to wrap my head around SOQL syntax and Joins.

I have been a SQL Server DBA/Developer for over 10 years and this Apex/SOQL stuff is confusion :-)

 

I need to Select all Account records where the associated Lead's Owner is like 'Queue')

 

First I tried this

SELECT Id FROM Account WHERE Id IN (SELECT Related_Owner__r.Id From Lead WHERE Owner.Name like '%Queue%')

 

But recieve the error "cannot have more than one level of relationships"

 

So I tried this

SELECT ID,(SELECT Owner.Name FROM Leads__r WHERE Owner.Name like '%Queue%') FROM Account 

 

This Runs but since it is a left join it returns all Accounts and any leads that match

 

I would like to do something like this

SELECT ID,(SELECT Owner.Name FROM Leads__r WHERE Owner.Name like '%Queue%') FROM Account  Where Leads__r.Id != null

 

But that does not work

 

How can I refrence a field form the right part of my join in the where clause

 

I have a header page that I want to include on serveral pages.
This header has info such as name, phone,email, etc.

The other pages lead a user through a series of questions similar to a visual workflow.
As they go along the user may need to edit fields on either form.

If I edit data on the included header page then press a save button on the main pag;
my data is not saved back to the database.  or vice versa.

If a user enters or changes data on either the main page or the included page I want to be able to save data to both pages with one button click


I know I could copy and paste the code from the header page into all of my pages but would prefer not to do that.
As we may need to make changes to the header fields and I do not want to have edit  every page everytime we want to make a change.

I am including striped down versions of my pages and extension.
I tried to use apex:actionSupport to fire a save action on my main page but that did not work.

Any help or guidence would be great.

------------------exHeader Page-----------------------------------------
<apex:page standardController="Lead" extensions="exMyLeadExtension">
    <apex:form >
   
     <apex:pageBlock title="Demographics" mode="detail">
        <apex:pageBlockSection columns="3">
                <apex:inputField value="{!Lead.FirstName}"/>
                <apex:inputField value="{!Lead.LastName}"/> 
                <apex:inputField value="{!Lead.Phone}"/>
                <apex:inputField value="{!Lead.MobilePhone}" style="width:100px"/>
                <apex:inputField value="{!Lead.Email}" style="width:100px" />
           </apex:pageBlockSection>
   
    <apex:pageBlockButtons location="Bottom" >
        <apex:commandButton id="saveButtonHeader" action="{!quicksave}" value="Save" />
    </apex:pageBlockButtons>
       
</apex:pageBlock>
       
    </apex:form>
</apex:page>

------------------exPage1 Page-----------------------------------------
<apex:page standardController="Lead" extensions="exMyLeadExtension" docType="html-5.0" title="Page1">
<apex:include pageName="exHeader"/>
<apex:actionSupport event="onClick"
                    action="{!quickSave}"
                    rerender="Page1"/>
                           
<apex:form >
    <apex:pageBlock id="Page1" title="Page 1" mode="detail">
        <apex:pageBlockSection >
                <apex:inputField value="{!Lead.Street}" style="width:200px" />
                <apex:inputField value="{!Lead.City}" style="width:100px" />             
        </apex:pageBlockSection> 
       
    <apex:pageBlockButtons location="Bottom" >
        <apex:commandButton id="saveButtonPage1" action="{!quicksave}" value="Save" />
        <apex:commandButton id="nextPage2Button" action="{!nextPage2}" value="Save go Page2" />
    </apex:pageBlockButtons>
     
    </apex:pageBlock>          
    </apex:form>
</apex:page>

------------------exPage2 Page -----------------------------------------
<apex:page standardController="Lead" extensions="exMyLeadExtension" docType="html-5.0" title="Page2">
<apex:include pageName="exHeader"/>
<apex:actionSupport event="onClick"
                    action="{!quickSave}"
                    rerender="Page2"/>
                           
<apex:form >
    <apex:pageBlock id="Page2" title="Page 2" mode="detail">
        <apex:pageBlockSection >
                <apex:inputField value="{!Lead.State}" style="width:100px" />
                <apex:inputField value="{!Lead.PostalCode}"  style="width:100px" />
        </apex:pageBlockSection> 
       
    <apex:pageBlockButtons location="Bottom" >
        <apex:commandButton id="saveButtonPage2" action="{!quicksave}" value="Save" />
        <apex:commandButton id="nextPage1Button" action="{!nextPage1}" value="Return to Page1" />
    </apex:pageBlockButtons>
     
    </apex:pageBlock>          
    </apex:form>
</apex:page>

------------------exMyLeadExtension Extension-----------------------------------------
String name;
    Boolean showGreeting = false;
   
    private final Lead lead;
   
    // The extension constructor initializes the private member
    // variable acct by using the getRecord method from the standard
    // controller.
    public exMyLeadExtension(ApexPages.StandardController stdController) {
        this.lead= (Lead)stdController.getRecord();
      
       
    }
 
    public PageReference nextPage1() {
        update lead;
        PageReference pageRef= Page.exPage1;
        pageRef.setRedirect(true);
        pageRef.getParameters().put('id',Lead.id);
        return pageRef;
    }
     
  public PageReference nextPage2() {
        update lead;
        PageReference pageRef= Page.exPage2;
        pageRef.setRedirect(true);
        pageRef.getParameters().put('id',Lead.id);
        return pageRef;
    }
   

}

Hi All,

I'm using same standard controller and same extention class for my page1 and page2. when i redirect from page1 to page2, i want to do some action in page 2 and i'm not getting any data of extention class calculated as a part of page1 in my vf page2. i put system.debug in my extention class and they are null when i perform any action in page 2 (like clicking button). I read many blogs and everywhere its suggested that having same controller will retain data accross the pages. I'm not sure what i'm missing here.

I'm redirecitng like this
PageReference page = new PageReference('Apex/Page2');
page.setRedirect(false);
return page;
Addition Info: Page 1 has standard set controller and page 2 has standard controller

Thanks in Advance
Srikrishna

Trying to wrap my head around SOQL syntax and Joins.

I have been a SQL Server DBA/Developer for over 10 years and this Apex/SOQL stuff is confusion :-)

 

I need to Select all Account records where the associated Lead's Owner is like 'Queue')

 

First I tried this

SELECT Id FROM Account WHERE Id IN (SELECT Related_Owner__r.Id From Lead WHERE Owner.Name like '%Queue%')

 

But recieve the error "cannot have more than one level of relationships"

 

So I tried this

SELECT ID,(SELECT Owner.Name FROM Leads__r WHERE Owner.Name like '%Queue%') FROM Account 

 

This Runs but since it is a left join it returns all Accounts and any leads that match

 

I would like to do something like this

SELECT ID,(SELECT Owner.Name FROM Leads__r WHERE Owner.Name like '%Queue%') FROM Account  Where Leads__r.Id != null

 

But that does not work

 

How can I refrence a field form the right part of my join in the where clause