• bcg
  • NEWBIE
  • 5 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 26
    Replies

 

i have a query regarding select option list...
i have records like 
emp_name     designation       type
abc                abc            selectoption list (leave type)
abc1               abc1           selectoption list (leave type)
abc2               abc2           selectoption list (leave type)
 when i am saving the records than the problem is when i am selcting value from select option than it will override my all records with tha last value
likeee
emp_name     designation       type
abc                abc            selectoption list (leave type l1)
abc1               abc1           selectoption list (leave type l2)
abc2               abc2           selectoption list (leave type l3)
Save
it will save it like
emp_name     designation       type
abc                abc            selectoption list (leave type l3)
abc1               abc1           selectoption list (leave type l3)
abc2               abc2           selectoption list (leave type l3)

i have a query regarding select option list...

  • May 26, 2011
  • Like
  • 0

Hello Everyone,

 

am facing some problem in test method code, actually am new to this and don't knw much about test method,  code coverage is done by this test method is 59%, but probelm am facing is ,So pls anyone check the code and tell me where am doing wrong, its giving error of :

Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Candidate_Name__c, Father_Name__c]: [Candidate_Name__c, Father_Name__c]
 

Please check the same if anyone knows....code of class is given below:

/*This apex class is used to save the Entrance Registration Data Entrance Registration Object, and Educational Information
of student. And educational information data is saving in Educational Information object.*/

//Apex Class
public class EntranceRegistrationCls{
 
    //Variable Declaration
    public String MasterId = '';
    public String EduRecordID;
    String TabURL;
    
    //Getter Setter Property Declaration
    public List<Educational_Information__c> EduList{get; set;}
    public Educational_Information__c Education{get;set;}
    
    //List Delcaration
    public list<Educational_Information__c> delList = new list<Educational_Information__c>();   
    public Entrance_Registration__c EntranceReg = new Entrance_Registration__c();
    public Entrance_Registration__c CurrentEntranceReg {get;set;}     
    ApexPages.StandardController controller;
    
    //constructor of EntranceRegistrationCls class
    public EntranceRegistrationCls(ApexPages.StandardController controller){        
        try{
            system.debug('yess');
            this.controller = controller;
            EntList = new List<Entrance_Registration__c>();
            EduList= new List<Educational_Information__c>();        
            EduList.add(new Educational_Information__c());
            Education= new Educational_Information__c();
            getMasterId();            
                if(MasterId == null || MasterId == ''){
                }else{
                    system.debug('Truee..>>'+MasterId);     
                    EntranceReg =[SELECT Id,Name FROM Entrance_Registration__c WHERE Id =:MasterId];
                    EduList=  [SELECT Id,Board_University__c,Degree_Diploma_Certificate_Etc_specify__c, Year_of_Passing__c,Education__c,Institute_College__c,Marks_CGPA__c,Mode_of_Education__c,
                               Status__c FROM Educational_Information__c WHERE Entrance_Master_Id__c =: EntranceReg.Id ];
                    system.debug('Yesssss--->>'+EduList);
                } 
        }
        catch(Exception ex){  
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage());
            ApexPages.addMessage(myMsg);
        }
    }
    //End of Constructor
    
    //Get Method for getting the current page id of Entrance Registration    
    public String getMasterId() {
        if(MasterId == null || MasterId == '')
            MasterId= ApexPages.CurrentPage().getParameters().get('ID');
            return MasterId;
    }
    //End of Get Method
    
    //Set Method for setting the value of Enratnce Registration    
    public void setMasterId(String val){
        MasterId = val;
    }
    //End of Set Method
    
    //To add any row method  
    public void addrow() {                              
        for(Integer i=0;i<EduList.size();i++){           
            EduList.add(new Educational_Information__c());                 
            return;
        }
    }
    //To remove any row method        
    public void removeRow(){  
        Integer i = EduList.size();
        if(EduList[i-1].Id <> null)
        delList.add(EduList[i-1]);
        EduList.remove(i-1); 
    }  
    // Save method to save whole data
    public PageReference save(){        
        Schema.DescribeSObjectResult SObjectResult = Schema.SObjectType.Entrance_Registration__c;
        String ObjectKey = SObjectResult.getKeyPrefix();
        TabURL = '/'+ ObjectKey +'/o';
        system.debug('Yes....>>'+TabURL);
            try{
                EntranceReg = (Entrance_Registration__c)controller.getRecord();
                CurrentEntranceReg = EntranceReg;
                system.debug('Yuuuupp>>>>'+CurrentEntranceReg);
                        
            }
            catch (Exception ex){
                ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage());
                ApexPages.addMessage(errMsg);
                return null;
            }
            try{
                if(CurrentEntranceReg.id <> null){
                        update CurrentEntranceReg;
                } else{
                        insert CurrentEntranceReg;
                  }
                  system.debug('Yes'+EduList);
                  
                for(Educational_Information__c ast: EduList){
                    if(ast.Id == null) 
                        ast.Entrance_Master_Id__c =  CurrentEntranceReg.ID;                        
                        ast.Education__c = ast.Education__c;
                        system.debug('Trueeeee...>'+ast.Entrance_Master_Id__c);
                        ast.Board_University__c = ast.Board_University__c;
                        ast.Institute_College__c = ast.Institute_College__c;
                        ast.Marks_CGPA__c = ast.Marks_CGPA__c;
                        ast.Mode_of_Education__c = ast.Mode_of_Education__c;
                        ast.Status__c = ast.Status__c;
                        ast.Year_of_Passing__c = ast.Year_of_Passing__c;
                        ast.Degree_Diploma_Certificate_Etc_specify__c=ast.Degree_Diploma_Certificate_Etc_specify__c;                    
                 }
                 system.debug('TRUE--->'+EduList);   
                upsert EduList;          
            }
            catch (Exception ex){
                ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage());
                ApexPages.addMessage(errMsg);
                return null;
            }            
            PageReference home = new PageReference(TabURL);        
            home.setRedirect(true);        
            return home;                                                
    }
    //End of Save Method
    static testMethod void testEntranceReg(){
        
        Test.startTest();
        PageReference PageRef = Page.EntranceRegistrationVf;
        test.setCurrentPage(PageRef);
        
       ApexPages.StandardController thecontroller = new ApexPages.StandardController(new Entrance_Registration__c());
       EntranceRegistrationCls controller = new EntranceRegistrationCls(thecontroller);
       controller.addrow();
       controller.removeRow();
        
        for(Entrance_Registration__c Ent:controller.CurrentEntranceReg){
            Ent.Candidate_Name__c ='Neeru';
            Ent.Father_Name__c ='Mr. Rakesh Nagpal';
        }
        controller.save();
        Test.stopTest();    
    }
        /*Entrance_Registration__c[] EntReg = new Entrance_Registration__c[]{
            new Entrance_Registration__c(
                Candidate_Name__c='Test Name',Father_Name__c='Test Father Name')};
         insert EntReg;
         
       ApexPages.StandardController thecontroller = new ApexPages.StandardController(new Entrance_Registration__c());
       EntranceRegistrationCls controller = new EntranceRegistrationCls(thecontroller);
       EntranceRegistrationCls  Ent =new EntranceRegistrationCls (thecontroller);
       Ent.save();
       Ent.addrow();
       Ent.removeRow(); */           
   
   /* static testMethod void myUnitTest() {
        PageReference PageRef = Page.EntranceRegistrationVf;
        test.setCurrentPage(PageRef); 
        Apexpages.Standardcontroller sc = new Apexpages.Standardcontroller(new Entrance_Registration__c());
        EntranceRegistrationCls controller = new EntranceRegistrationCls(sc);
        String MasterId;
        controller.setMasterId(MasterId);
        controller.addrow();
        controller.removeRow();
        controller.save();
    }*/
 
}
//End of Apex Class

 

when am saving this its giving error :

Compile Error: Loop must iterate over a collection type: SOBJECT:Entrance_Registration__c at line 140 column 42

Thanks In Advance

  • April 21, 2011
  • Like
  • 0

Hello everyone,

 

I am facing some problem. Please help me out if anyone knows.

I have two objects Add Floor and Add Room. in Add Floor object i have two fields "Series Start From" and "Number of Floors" when i add this like:

Number of Floor : 5

Series Start from: A

then after click on button it divide it like: A1,A2,A3,A4,A5  button will show this out put on net page.

But i want this output value in pick list field and that picklist field is in Add Room Object. e.g when i add rooms then on that screen i want the picklist of Floor like A1,A2,A3,A4,A5.

 

I have done this upto output on next page but i don't knw how to update that values on next visualforce page in picklist. Please anyone gave me any idea for the same.

 

Page Code:

<apex:page standardStylesheets="false" >
<apex:form id="frmOne">
<apex:pageBlock >
<apex:pageBlockSection title="Floors">
<apex:outputLabel style="font-weight:bold;" value="Series Start From:" for="series"/>
<apex:inputText id="series" required="true" />
<apex:outputLabel style="font-weight:bold;" value="Number of Floors:" for="floors"/>
<apex:inputText id="floors" required="true"/>
<apex:outputLabel style="font-weight:bold;" value="Floors:" for="floors1"/>
<apex:inputTextarea id="Floors1"/>

<apex:outputText id="output" />
<apex:commandButton value="floors" onclick="move()" />
<script type="text/javascript">

function move()
{
var ex = document.getElementById('{!$Component.series}').value;
var ex1 = document.getElementById('{!$Component.floors}').value;
document.write("Floors Are:");
for (i=1;i<=ex1;i++)
{
var input=document.write(ex+i+",");
}
}
document.getElementById('{!$Component.floors1}').value="Hello";

</script>
</apex:pageBlockSection>
</apex:pageBlock>
 </apex:form>
</apex:page>

 Please help me...... its urgent for me........

 

Thanks In Advance

  • December 01, 2010
  • Like
  • 0

Hello,

 

I have two screens one is for add room and other is for add floor. in add floor screen i have two input Fields i.e. Number of Floors and Series Start from. if i enter number of Floor= 5 and Series Start from= A then in other screen i.e. Add room Screen a picklist is created i.e. Floor in that options are like A1,A2,A3,A4,A5. these value are based on that two input fields. and the picklist is updated when a new records user create.

 

Please help me out how to do this if anyone having idea regarding this.

 

 

Thanks In Advance.

  • November 29, 2010
  • Like
  • 0

Hello Everyone,

 

 I am facing some problem in locking the records. pls anyone know how to solve this problem then tell me. i want when i save some records and that records are visible in related list, but after 24hrs that records are disable for end users. how it is possible.

 

 

Thanks In advance.

  • November 29, 2010
  • Like
  • 0

Hi all,

 

I'm new in Salesforce. I try to select multiple values, for example we select Users, from the lookup search button. It can only select one User in each field. If we want to get two Users in one field, how to use to lookup search? What and where should I make up configurations?

 

 

 

Thanks a lot.

  • November 16, 2010
  • Like
  • 0

Hello Everyone,

 

I am facing query regarding disable day for particular day. i want when i mark attendance for one day or that particular date, then next day that date will be disabled or am not able to mark attendance for same day again. or if it allow me to mark attendance again for same day this will override old records with new one. 

 

Please anyone know hoe its possible or how to do that. Pls give suggestions.

 

 

Thanks In Advance.

  • November 15, 2010
  • Like
  • 0

I need to  get all feild values of rows in the columns of a table i.e as table heading.

 

 

can anybody esnd code to do this via a simple table or datatable or pageblock table etc..

 

 

 

 

  • November 08, 2010
  • Like
  • 0

hello,

 

Anyone pls tell me how to copy one fields value in another field in salesforce on click of button. i want after filling permant address when i click on button the same will be copied in correspondence address.

 

If anyone know pls help me ot or if having any example code pls post it.

 

Thanks In advance.

  • October 27, 2010
  • Like
  • 0

Hello ,

 

I want to display values of child window on parent window. e.g.  i have one page and when on that page when i click on textbox a new window popup. in that popu window some lookup fileds are present and i want when i slect value from tha lookup fields and click on save button. value wil be saved in record and it also display on that textbox in the parent window and popup window close after that.

 

Please anyone tell me how to fetch the values on parent window.

 

 

Thank in Advance.

  • October 20, 2010
  • Like
  • 0

Hello Everyone,

 

 I want to create my application i.e. Time Table Software using salesforce.  am new to salesforce, and am not getting the idea to creat that application. anyone please help me out for the same??

 

Thanks In Advance

 

  • October 12, 2010
  • Like
  • 0

Hello,

 

anyone plz help me.

 

I want to render the pageblocksection, when i select values from picklist fromanother pageblocksection on same page then secong page block section rendered and shows the values accroding to selected values.

 

How can i solve this.. anyone knows plz help me......

  • August 25, 2010
  • Like
  • 0

Hello Everyone,

 

am facing some problem in test method code, actually am new to this and don't knw much about test method,  code coverage is done by this test method is 59%, but probelm am facing is ,So pls anyone check the code and tell me where am doing wrong, its giving error of :

Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Candidate_Name__c, Father_Name__c]: [Candidate_Name__c, Father_Name__c]
 

Please check the same if anyone knows....code of class is given below:

/*This apex class is used to save the Entrance Registration Data Entrance Registration Object, and Educational Information
of student. And educational information data is saving in Educational Information object.*/

//Apex Class
public class EntranceRegistrationCls{
 
    //Variable Declaration
    public String MasterId = '';
    public String EduRecordID;
    String TabURL;
    
    //Getter Setter Property Declaration
    public List<Educational_Information__c> EduList{get; set;}
    public Educational_Information__c Education{get;set;}
    
    //List Delcaration
    public list<Educational_Information__c> delList = new list<Educational_Information__c>();   
    public Entrance_Registration__c EntranceReg = new Entrance_Registration__c();
    public Entrance_Registration__c CurrentEntranceReg {get;set;}     
    ApexPages.StandardController controller;
    
    //constructor of EntranceRegistrationCls class
    public EntranceRegistrationCls(ApexPages.StandardController controller){        
        try{
            system.debug('yess');
            this.controller = controller;
            EntList = new List<Entrance_Registration__c>();
            EduList= new List<Educational_Information__c>();        
            EduList.add(new Educational_Information__c());
            Education= new Educational_Information__c();
            getMasterId();            
                if(MasterId == null || MasterId == ''){
                }else{
                    system.debug('Truee..>>'+MasterId);     
                    EntranceReg =[SELECT Id,Name FROM Entrance_Registration__c WHERE Id =:MasterId];
                    EduList=  [SELECT Id,Board_University__c,Degree_Diploma_Certificate_Etc_specify__c, Year_of_Passing__c,Education__c,Institute_College__c,Marks_CGPA__c,Mode_of_Education__c,
                               Status__c FROM Educational_Information__c WHERE Entrance_Master_Id__c =: EntranceReg.Id ];
                    system.debug('Yesssss--->>'+EduList);
                } 
        }
        catch(Exception ex){  
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage());
            ApexPages.addMessage(myMsg);
        }
    }
    //End of Constructor
    
    //Get Method for getting the current page id of Entrance Registration    
    public String getMasterId() {
        if(MasterId == null || MasterId == '')
            MasterId= ApexPages.CurrentPage().getParameters().get('ID');
            return MasterId;
    }
    //End of Get Method
    
    //Set Method for setting the value of Enratnce Registration    
    public void setMasterId(String val){
        MasterId = val;
    }
    //End of Set Method
    
    //To add any row method  
    public void addrow() {                              
        for(Integer i=0;i<EduList.size();i++){           
            EduList.add(new Educational_Information__c());                 
            return;
        }
    }
    //To remove any row method        
    public void removeRow(){  
        Integer i = EduList.size();
        if(EduList[i-1].Id <> null)
        delList.add(EduList[i-1]);
        EduList.remove(i-1); 
    }  
    // Save method to save whole data
    public PageReference save(){        
        Schema.DescribeSObjectResult SObjectResult = Schema.SObjectType.Entrance_Registration__c;
        String ObjectKey = SObjectResult.getKeyPrefix();
        TabURL = '/'+ ObjectKey +'/o';
        system.debug('Yes....>>'+TabURL);
            try{
                EntranceReg = (Entrance_Registration__c)controller.getRecord();
                CurrentEntranceReg = EntranceReg;
                system.debug('Yuuuupp>>>>'+CurrentEntranceReg);
                        
            }
            catch (Exception ex){
                ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage());
                ApexPages.addMessage(errMsg);
                return null;
            }
            try{
                if(CurrentEntranceReg.id <> null){
                        update CurrentEntranceReg;
                } else{
                        insert CurrentEntranceReg;
                  }
                  system.debug('Yes'+EduList);
                  
                for(Educational_Information__c ast: EduList){
                    if(ast.Id == null) 
                        ast.Entrance_Master_Id__c =  CurrentEntranceReg.ID;                        
                        ast.Education__c = ast.Education__c;
                        system.debug('Trueeeee...>'+ast.Entrance_Master_Id__c);
                        ast.Board_University__c = ast.Board_University__c;
                        ast.Institute_College__c = ast.Institute_College__c;
                        ast.Marks_CGPA__c = ast.Marks_CGPA__c;
                        ast.Mode_of_Education__c = ast.Mode_of_Education__c;
                        ast.Status__c = ast.Status__c;
                        ast.Year_of_Passing__c = ast.Year_of_Passing__c;
                        ast.Degree_Diploma_Certificate_Etc_specify__c=ast.Degree_Diploma_Certificate_Etc_specify__c;                    
                 }
                 system.debug('TRUE--->'+EduList);   
                upsert EduList;          
            }
            catch (Exception ex){
                ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage());
                ApexPages.addMessage(errMsg);
                return null;
            }            
            PageReference home = new PageReference(TabURL);        
            home.setRedirect(true);        
            return home;                                                
    }
    //End of Save Method
    static testMethod void testEntranceReg(){
        
        Test.startTest();
        PageReference PageRef = Page.EntranceRegistrationVf;
        test.setCurrentPage(PageRef);
        
       ApexPages.StandardController thecontroller = new ApexPages.StandardController(new Entrance_Registration__c());
       EntranceRegistrationCls controller = new EntranceRegistrationCls(thecontroller);
       controller.addrow();
       controller.removeRow();
        
        for(Entrance_Registration__c Ent:controller.CurrentEntranceReg){
            Ent.Candidate_Name__c ='Neeru';
            Ent.Father_Name__c ='Mr. Rakesh Nagpal';
        }
        controller.save();
        Test.stopTest();    
    }
        /*Entrance_Registration__c[] EntReg = new Entrance_Registration__c[]{
            new Entrance_Registration__c(
                Candidate_Name__c='Test Name',Father_Name__c='Test Father Name')};
         insert EntReg;
         
       ApexPages.StandardController thecontroller = new ApexPages.StandardController(new Entrance_Registration__c());
       EntranceRegistrationCls controller = new EntranceRegistrationCls(thecontroller);
       EntranceRegistrationCls  Ent =new EntranceRegistrationCls (thecontroller);
       Ent.save();
       Ent.addrow();
       Ent.removeRow(); */           
   
   /* static testMethod void myUnitTest() {
        PageReference PageRef = Page.EntranceRegistrationVf;
        test.setCurrentPage(PageRef); 
        Apexpages.Standardcontroller sc = new Apexpages.Standardcontroller(new Entrance_Registration__c());
        EntranceRegistrationCls controller = new EntranceRegistrationCls(sc);
        String MasterId;
        controller.setMasterId(MasterId);
        controller.addrow();
        controller.removeRow();
        controller.save();
    }*/
 
}
//End of Apex Class

 

when am saving this its giving error :

Compile Error: Loop must iterate over a collection type: SOBJECT:Entrance_Registration__c at line 140 column 42

Thanks In Advance

  • April 21, 2011
  • Like
  • 0

Hello Everyone,

 

Actually, am designing reports on visualforce page, not using Standard reports of salesforce. i want to implement button name Export to Excel. am not getting anything to implement the same. If anyone know the coding for export button pls post the code.

 

Pls help me for the same.

 

 

Thanks In Advance

 

Hello,

 

I have two screens one is for add room and other is for add floor. in add floor screen i have two input Fields i.e. Number of Floors and Series Start from. if i enter number of Floor= 5 and Series Start from= A then in other screen i.e. Add room Screen a picklist is created i.e. Floor in that options are like A1,A2,A3,A4,A5. these value are based on that two input fields. and the picklist is updated when a new records user create.

 

Please help me out how to do this if anyone having idea regarding this.

 

 

Thanks In Advance.

  • November 29, 2010
  • Like
  • 0

Hello Everyone,

 

 I am facing some problem in locking the records. pls anyone know how to solve this problem then tell me. i want when i save some records and that records are visible in related list, but after 24hrs that records are disable for end users. how it is possible.

 

 

Thanks In advance.

  • November 29, 2010
  • Like
  • 0

Hi all,

 

I'm new in Salesforce. I try to select multiple values, for example we select Users, from the lookup search button. It can only select one User in each field. If we want to get two Users in one field, how to use to lookup search? What and where should I make up configurations?

 

 

 

Thanks a lot.

  • November 16, 2010
  • Like
  • 0

Hi i have a canvas area where users draw their signatures, but how can i capture this as an attachment when saving?

I have a question regarding a "export data to excel" on a Visualforce page.

For example, I retrieve a bunch of records of a SObject on the extension class in a List ( like "List<Account>").
I want to create a button or a link on the visualforce page to export all the records inside that list to Excel.

Is that possible, does anybody knows how to do it ?

  • August 30, 2010
  • Like
  • 0

I have query results coming as following: for contact 1 for three questions and answers.

 

for Contact 1

 Q1  - ans1

 Q2 - ans2

  Q3 - ans3

 

for Contact 2

 Q1  - ans1

 Q2 - ans2

  Q3 - ans3

I want to dislay the above results as following:

       Q1    Q2    Q3

C1   ans1 ans2 ans3

C3   ans1 ans2 ans3

 can someone please help me create a class in my controller that help create this display in my apex page? How to display column values as row hearders..

 

I really appreciate any suggestions?

 

 

Hi All,

 

I'm developing application on force.com platform and I need to do the following:

 

1) upload image using Visualforce page

2) save uploaded image to the force.com database 

3) retrieve saved image from the database and display it on another Visualforce page 

 

For step 1 I can use <apex:inputFile ../> component to get an Apex blob object representing uploaded image.

However, for step 2 I don't know how to save this object to force.com database as it doesn't support blob fields.

For step 3 I assume I can use <apex:image .. /> component to display the image.

 

Could anyone advice if I'm on the right track or what is the right way to do this kind of things on Force.com platform?

 

Thanks in advance,

Dennis 

Hi,

 

I have a VF page in which i have Apex input text controls and a command Button control.

I am able to fill the Text boxes using the properties created in the controller.

 

My requirement here is when clicked on the command button in the Vf page i want to dynamically add a input text to the VF page.

 

Can we do it using Apex code??.

 

I have been looking around for adding controls in VF page using Apex code. I went through the developers guide and cook book for reference even then i failed to get the result.

 

Do any one have an idea about adding apex controls dynamically??

Please help me out...This might be a very silly question to ask but i am not able to resolve this problem from days.

 

Thanks in Advance,

pspl 

 

 

 

 

 

<script> function getValue () { var myString = 'Test Value'; return myString; } </script> <apex:pageBlockTable value="{!myData}" var="aMyData" id="MyData"> <apex:column headerValue="My Custom Value"> <!--getValue() is my supposed javascript function that will return me the value -> <apex:outputField value="{!$getValue ();}"/> </apex:column> </apex:pageBlockTable>

 

I want to get some value placed in the 'value' attribute of my apex:outputFiled/apex:inputFiled through a javascript. Is it possible?
Following is the code for what i want to do (this code will not work, just to explain what I want to do)

 

Regards,

Rao

 

 

Message Edited by Kamran-Rao on 06-30-2009 04:59 AM
I have created a custom object for Sales Aid & Sample Requests.  The purpose of this object is to enable the user to put in a request from either the Lead or the Contact for various sales aids or samples.  Once the request is completed, it will be emailed to the appropriate fulfillment person and copied to additional internal people.

Since a Sales Aid or Sample can be requested for either a Lead or a Contact, I would like to use the same object on both of these objects (Lead/Contact).  I have a Lookup field for Contact as well as a Lookup field for Lead.  My problems start when I want to use a formula field to bring in the Lead Address or Contact Address, depending upon whether the request is generated from a Lead or a Contact.  There are a few other fields that I would also like to use a formula to populate, but of course, these field names differ between the two.  Of course, I can create a "Lead Address field" and a "Contact Address field", etc., but this looks messy so I was looking for a way to (1) identify whether the request is being generated from a Lead or Contact (2) Pass by formula the correct values and (3) still be able to pull all of the fields into an email template, so even our personnel without Salesforce.com licenses can see that the sample/sales aid was requested.  I will also need to be able to pull together a single report of all of the sales aids/samples fulfilled. 

Does anyone have any suggestions or knowledge of how to identify what object the request was generated from, and then have the remaining formula fields reference and return the correct values?

Thanks for any insight as I've been mulling on this one for some time.
Hello everyone, just wanted to share with the community this custom component I made and give something back for the help I've received. :smileyhappy:

The purpose of the component is to enable autocomplete in lookup fields. I used the autocomplete js created by Jim Roos:
(http://www.jimroos.com/2007/05/ajax-autocomplete.html) but made some modifications to it so that it could interact with an Apex controller among some other things...

So my idea was that if you were making a VF page that had an inputfield that was related to a lookupfield you would just insert this autocomplete component to that inputfield. Something like this:

Code:
           <apex:inputField value="{!Contact.accountid}" id="accname" styleClass="cField">
<c:autocomplete ObjectName="Accounts" InputId="{!$Component.accname}" AutoCompleteId="accACid" ClassName="autocomplete300"/>
</apex:inputField>

The component has 4 parameters:

The name of the object or custom object that the inputfield relates to (new objects must be added inside the apex classes since i had some problems constructing a dynamic query).
The InputId which is used to relate the component to the input field
The id for the Component
A classname parameter that basically just defines the width of the suggestions menu.

Here's a screenshot of how it looks like in action:




Here's a link to the file containing the required files:

AutoCompleteComponent



Jonathan.


Message Edited by jonathan rico on 08-16-2008 01:55 PM

Message Edited by jonathan rico on 08-17-2008 09:04 AM
Message Edited by jonathan rico on 01-02-2010 05:01 PM