Okay so here is my visualforce page

<apex:page standardController="Account" extensions="RelationshipTreeController">
    <apex:form >
        <apex:dataList value="{!relationships}" var="relation">
            <apex:commandLink action="{!relationDetailClicked}">
                <apex:param value="{!relation.Id}" assignTo="{!selectedDetailID}" />
                <apex:outputText value="{!relation.Second_Account__r.Name} ({!relation.Second_Relationship_Type__r.Name})" rendered="{!IF(relation.Second_Account__c != null && relation.Second_Account__c != account.Id, true, false)}"/>

and here are the relevant bits of my extension:

public List<Relationship_Detail__c> relationships { get; set; }
public Id recordID { get;set; }
public Id selectedDetailID { get;set; }
public Relationship_Detail__c selectedDetail { get;set; }

public void relationDetailClicked() {
      System.assert(selectedDetailID != null);
      selectedDetail = [SELECT Id, First_Contact__c, Second_Contact__c, First_Account__c, Second_Account__c, First_Contact__r.Name, First_Account__r.Name, Second_Contact__r.Name, Second_Account__r.Name, First_Relationship_Type__r.Name, Second_Relationship_Type__r.Name
                     FROM Relationship_Detail__c
                     WHERE Id = :selectedDetailID];

So what I am trying to do is iterate through a list of custom objects (relationship_detail__c) and each iteration I store the current object in relation. I only want to print a certain relation hence that rendered attribute on the outputText but when a user clicks it I want the visualforce page to save the current object in relation to the selectedDetail. However, apparently the value attribute of the apex:param is limited in that it cannot be custom objects so i settled for just doing the Id part of the object and then doing the database call in the relationDetailClicked() method. My problem is that it is failing the assert that I placed there as a check. Can anyone shed some wisdom and light on my problem?


1 Answer 1


Try changing it to this by adding a name attribute to the Apex:param

 <apex:param value="{!relation.Id}" assignTo="{!selectedDetailID}" name="dtlIdParam"/>

Source: <apex:param> assignTo attribute not setting value to contoller variable

  • 1
    Amazing how it was something that to me seems so trivial. On the developer page it says that the value is the only required attribute. Anyways thank you very much for your insight! Jun 17, 2014 at 18:27
  • yeah its happened to me many times before... Glad it worked.:)
    – Richard N
    Jun 17, 2014 at 20:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .