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
Wheaton003Wheaton003 

Apex:Param variable not being updated in Controller

Hi,

 

I'm trying to pass a variable from visualforce to my Apex controller in a <apex:support> block. The assignTo function is never called, even after the page is finished loading, and neither is doParamPass. I'm simply trying to pass l.phone and l.email back to the controller to search for duplicates and return a list. l is a variable for a lead, who I would like to check for duplicates.

 

I also tried to use <apex:inputhidden>, but no luck there either. I can't access otherName from the controller.


Any help is appreciated!

 

VISUALFORCE:

           <apex:column >
                <apex:facet name="header">Lead Dups</apex:facet>
                <apex:actionsupport event="onload" action="{!doParamPass}">
                    <apex:param name="dup_email" value="testMail@yahoo.com" assignTo="{!dup_email}"/>
                    <apex:param name="dup_phone" value="{!l.phone}" assignTo="{!dup_phone}"/>
                </apex:actionSupport>
                <apex:form ><apex:inputhidden id="otherName" value="{!l.email}" /></apex:form>
                <apex:repeat value="{!DupWarning}" var="d">
                <apex:outputLink value="{!URLFOR($Action.Lead.View, d.id)}" id="name"> {!d.Name} </apex:outputlink>
                </apex:repeat>
            </apex:column>

 

APEX CONTROLLER:

 

public String dup_phone {
        get;
        // *** This set method is NOT being called ***
        set {
            dup_phone = value;
            System.debug('DUP PHONE IS: '+value);
        }
    }
    public String dup_email {
        get;
        // *** This set is NOT being called ***
        set {
            dup_email = value;
            System.debug('DUP EMAIL IS: '+value);
        }
    }
    public void doParamPass() {
        System.debug('Param pass executed');
    }

bob_buzzardbob_buzzard

actionsupport is intended to add Ajax support to another component to allow it to handle events occurring to it.  Onload doesn't really fit into this category.   The fact that its embedded within a column is also strange, as that would require each row of the parent table to take action at page load time.

 

Can you tell us some more about what you are trying to achieve?

 

 

 

Wheaton003Wheaton003

I didn't think using ActionSupport should be needed, but I read param must be wrapped within it.

 

I have a simple table showing a List<Lead> with 4 columns - Using the email address from from each Lead, I would like to check for existing leads or contacts with this email address, and show them all in the last column. So after retreiving the list of Leads from the controller, I want to pass back each email address into a function that searches for a lead with that email address.

 

Perhaps I could do this email search in the original lead query using a SELECT AS statement?

 

List<Lead> newLeads = [SELECT Id, Name, Company, email, CreatedBy.FirstName 
                                              (SELECT Id, Name

                                                                    FROM Lead

                                                                    WHERE email = X.email)

                                              AS X

                                              FROM Lead
                                              WHERE CreatedDate > :datetime.now().addDays(range * (-1))
                                              ORDER BY CreatedDate DESC, ID DESC
                                              LIMIT 6];