1

I am having trouble getting the Id from the selected record to pass to my controller. When I check my debug the value of "accId" reports back as NULL.

Here is my VF Page (code trimmed):

<apex:page controller="controller_AccountServicing" sidebar="false">

    <apex:form id="theForm">
        <div id="header">
            <b>Account Servicing Activities (This Week)</b>
        </div>

        <div id="section" >
            <apex:pageBlock id="thePage">

                <apex:pageBlockTable value="{!Activities}" var="acc" id="Detail" >


                    <apex:column style="align:center;text-align:center;">
                        <apex:facet name="header">Activity Name</apex:facet>
                        <apex:outputlink target="_blank" value="/{!acc.Id}">{!acc.Name}</apex:outputlink>
                    </apex:column>                 


                <apex:column >
                    <apex:commandButton value="Update" action="{!updateWindow}">
                        <apex:param name="activityId" assignTo="{!accid}" value="{!Acc.Id}"/>
                    </apex:commandButton>
                </apex:column>


                </apex:pageBlockTable>

            </apex:pageBlock>
        </div>

    </apex:form>
</apex:page>

Here is my controller (code trimmed):

public class controller_AccountServicing {
    //Create Variables
    list    <Account_Servicing_Activity__c> accActivities   = new list<Account_Servicing_Activity__c>();
    public  boolean renderPrompt    {get;set;}
    public  Id      accId           {get;set;}

    public controller_AccountServicing(){
        //Initilization items
        Id currentuser = system.UserInfo.getUserId();

    }

    public List<Account_Servicing_Activity__c> getActivities() {
            accActivities = [Select Id,Name,(OTHER FIELDS)
                            FROM Account_Servicing_Activity__c
                            ];

            return accActivities;   
    }

    public void updateWindow() {
        renderPrompt = TRUE;
        system.debug('Activity ID = ' + accId);
    }

    public void updateRecord() { 

        try {
            renderprompt = false;
        } catch(DmlException e) {
            ApexPages.addMessages(e);
            System.debug('The following exception has occurred: ' + e.getMessage());

        }

    }

}
4

apex:param is not supported on apex:commandButton. Either use a normal button and call an apex:actionFunction, or use an apex:commandLink.

The only elements that are supported with apex:param are as follows:

<apex:actionFunction>
<apex:actionSupport>
<apex:commandLink>
<apex:outputLink>
<apex:outputText>
<flow:interview>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.