I know there are other questions similar to this but I could not figure out a way to solve my issue. In my Visualforce page, I have a repeater - I need to call the controller method to get data from another object using ID from the repeater object.
Visualforce:
<apex:repeat var="a" value="{!articles}">
<!-- this is how I am setting the ArticleId variable in apex ---NOT WORKING -->
<apex:param name="ArticleId" value="{!(a.Article_Id__c)}" assignTo="{!ArticleId}"/>
<!setFaqAnswer> <!-- Calling the method -->
<div class="divQuestion" "> {!a.Title__c} </div>
<div class="divSummary" > {!a.Summary__c} </div>
<div class="divAnswer" > {!faq.Answer__c} </div> <!-- <-- Using the faq object here -->
</apex:repeat>
Controller:
public FAQ faq {get;private set;}
public Id ArticleId {
get; set;
}
public void setFaqAnswer {
get {
try {
faq = [select Answer__c, Links__c from FAQ__kav where KnowledgeArticleId = :ArticleId and IsVisibleInPkb = true];
}
catch (QueryException qe) {
System.debug('@@@@' + qe); // <-- Not being able to view this in setup>log>debug logs
}
}
}