• mkasper
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies

Experts,

 

I am trying to create a multiple lookup field on same the same object through a Visualforce page.  This page will act just as the partner lookup field does to where you can lookup multiple partners.

 

Here is the code I started with from another post Link:

 

Can anyone tell me why this code isn't working?

 

I am a beginner in Visualforce so please excuse my ignorance.

 

Mike

Hello Experts,

I am in progress of customizing the standard partner page of salesforce due to some custom requirement

Standard Partner page:



Here each textbox fields are attached with Account Name lookup field.

Similarly when I started creating my custom Partner VisualForce page, and when i click on second look up button which is next to second textbox field and select any account name, it always update first textbox field value only. Now I am not sure how to handle multiple lookup field on same object field using VisualForce? Any help in order to resolve this issue would higly appriciated.

Page Editor Code:

<apex:page controller="webdev" tabStyle="Partner">
<apex:sectionHeader title="Partner"/>
  <apex:form >
  <apex:pageBlock title="Partner Edit">        
         <apex:panelGrid columns="5" width="30%">
                <apex:outputLabel > &nbsp;&nbsp;&nbsp; </apex:outputLabel>
                <apex:outputLabel > &nbsp; </apex:outputLabel>
                <apex:outputText value="Primary"/>
                <apex:outputText value="Partner"/>
                <apex:outputText value="Role"/>
         </apex:panelGrid>
         <apex:panelGrid columns="3" width="30%">
             <apex:outputLabel > &nbsp; </apex:outputLabel>
            
             <apex:inputField value="{!Opportunity.AccountId}" />
             <apex:selectList value="{!partnerRoles}" size="1">
            <apex:selectOptions value="{!roles}"/>
                </apex:selectList>
               
                <apex:outputLabel > &nbsp; </apex:outputLabel>
               
                <apex:inputField value="{!Opportunity.AccountId}" />
        <apex:selectList value="{!partnerRoles}" size="1">
            <apex:selectOptions value="{!roles}"/>
                </apex:selectList>
               
         </apex:panelGrid>
         <apex:facet name="footer">
            <apex:commandButton value="Save" action="{!savePartnerData}" />
        </apex:facet>
    </apex:pageBlock>
  </apex:form>
</apex:page>

Page Controller Code:

public class webdev {
//public string partnerRoles{get;set;}
Opportunity opportunity;
String partnerRoles;

    public String getPartnerRoles () {
      return partnerRoles;
    }

    public void setpartnerRoles (String partnerRoles ) {
        this.partnerRoles  = partnerRoles ;
    }
 
   public PageReference savePartnerData() {
      PageReference opptyPage = new PageReference('http://www.google.com/?newid=' + Opportunity.AccountId);
      return opptyPage ;
   }
  
   public Opportunity getOpportunity() {
        if(opportunity == null) opportunity = new Opportunity();
            return opportunity;
    }

    public List<SelectOption> getRoles() {
          List<SelectOption> options = new List<SelectOption>();
          PartnerRole[]  partnerRole = [Select  MasterLabel from PartnerRole  where CreatedById <> null];
          options.add(new SelectOption('--None--','--None--'));
          for(Integer i=0;i<partnerRole.size();i++)
          {
              options.add(new SelectOption(partnerRole[i].MasterLabel,partnerRole[i].MasterLabel));
          }
        return options;
      }
}