function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bermager@gmail.combermager@gmail.com 

Passing variable from one class to another

Hi, I have a requirement to create a contact checklist on a VF page(opens in a new window).

It works simple:

there is a VF page which has a contact lookup field. When user clicks on a lookup, the javascript(thanks to Jeff Douglas) catches the lookup page and shows my custom VF page instead, The page contains "selectCheckboxes" and a user selects some contacts. In the end I have a list of selected contacts. Then, when user clicks "Save" button, the Custom Contact Lookup page shpould be closed and the contact data should appear in the source field(contact lookup) and should be accesible in my class(the main one)

 

Is there any way to do this? Looked through tons of forums and so on, can't think a way how to do this...

 

Thanks for any help!

bermager@gmail.combermager@gmail.com

Here is my VF page 

<apex:page standardController="Account" extensions="DocumentEmailControlleraddr" title="Search" showHeader="false" sideBar="false" tabStyle="Account" id="pg">

  <apex:form >
    <apex:pageBlock title="Select Recepient" dir="LTR">
          <apex:pageBlockButtons >
        <apex:commandButton action="{!SendOk}" value="Ok" oncomplete="close()"/>
      </apex:pageBlockButtons>
      <apex:pageBlockSection columns="1"> 
       
              <apex:pageBlockSectionItem >   
        	<apex:selectCheckboxes value="{!contId}" layout="pageDirection" dir="LTR">
            <apex:selectOptions value="{!Addresses}"/>
        	</apex:selectCheckboxes>
        </apex:pageBlockSectionItem>


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

 and a class:

public with sharing class DocumentEmailControlleraddr {

  public String[] contId = new String[]{};
  public String[] contlistglobal = new String[]{}; 
  public URL baseURL {get; set;}
  public String url_accid {get; set;}
  public ApexPages.Standardcontroller controller {get; set;} 
  public DocumentEmailControlleraddr(ApexPages.StandardController controller) 
  {
    baseURL = System.URL.getCurrentRequestUrl();
	url_accid = String.ValueOf(baseURL);
	url_accid = url_accid.substringBetween('%7C%7C%7C', '%7C%7C%7C');
  }
      
        public List<SelectOption> getAddresses() 
    {
    	List<Contact> contlist = [Select c.Name, c.Id, c.Email, c.AccountId From Contact c WHERE c.AccountId=:url_accid];
        List<SelectOption> options = new List<SelectOption>();
        for (Integer i = 0; i < contlist.size(); i++)
        {
            SelectOption option = new SelectOption(contlist[i].Id, contlist[i].Name+' ('+contlist[i].Email+')');
            options.add(option);
            
        }
       
        return options;
    }




    public String[] getcontId() {
        return contId;
    }
 
    public void setcontId(String[] contId) {
        this.contId = contId;
    }
  public pageReference SendOk()
{


return null; 

}
}

 So, can't get what and how should I return my contid list(or any transformated data) into my main class(VF page).

 

So the goal is to close this window and pass a variable back to the page where contact lookup field is based.

is it possible at all?

bermager@gmail.combermager@gmail.com
Please, just point me on the document I have to read to do this =))