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
Amanda Byrne- Carolina Tiger RescueAmanda Byrne- Carolina Tiger Rescue 

How can I display my controller query result on a VF page?

I'm working on a visual force page for a mobile app

Code from Controller (summarized to relevant parts):
global with sharing class DTCI_Remote_Methods_Ctrl {   
    public String attendeeId {get; set;}         
                           
    public DTCI_Remote_Methods_Ctrl (ApexPages.StandardSetController controller) {
        attendeeId = ApexPages.currentPage().getParameters().get('attendeePageId');          
    }


 @RemoteAction
        //Get attendee specified by attendeeId
        global static List<CnP_PaaS_EVT__Event_attendee_session__c> getconfirmedAttendee(string attendeeId){
           
            List<CnP_PaaS_EVT__Event_attendee_session__c> confirmedAttendee = [SELECT Id, Name, CnP_PaaS_EVT__First_name__c, CnP_PaaS_EVT__Last_name__c                                                                                                               
                                                                       FROM CnP_PaaS_EVT__Event_attendee_session__c                                                                            
                                                                       WHERE Id = :attendeeId       
                                                                           AND DTCI_Agreement_Active__c = TRUE
                                                                       ORDER BY Name                                                                                    
                                                                      ];
            return confirmedAttendee;                                
        }

Code from VF Page (summarized):

<apex:page standardController="CnP_PaaS_EVT__Event_attendee_session__c" extensions="DTCI_Remote_Methods_Ctrl" recordSetVar="attendees"
           docType="html-5.0" standardStylesheets="false" showheader="false" sidebar="false">

<script>    
    $j=jQuery.noConflict();  
    var attendeeJsId = '{!$CurrentPage.Parameters.attendeePageId}';

   DTCI_Remote_Methods_Ctrl.getconfirmedAttendee(attendeeJsId, function(result,event){
        if(result.length === 0){
            $j("#confirmedAttendeeId").append("No results<br />");
        }else 
                              
            $j("#confirmedAttendeeId").append("<title1>" + result.Name + "has checked in</title1>" + "<br/><br/>" );                                                                                                                                                                                                                                                                                
        
                    
    }, {escape:true});

Everything works great on the page with the exception of returning the value of result.Name, it simply says 'undefined'.

I think I just need a little syntax tweak, but for the life of me can't figure it out!

assistance much appreciated, Amanda 
Best Answer chosen by Amanda Byrne- Carolina Tiger Rescue
Prosenjit Sarkar 7Prosenjit Sarkar 7
Hi Carolina,

try result[0].Name instead of result.Name

Thanks :)

All Answers

Prosenjit Sarkar 7Prosenjit Sarkar 7
Hi Carolina,

try result[0].Name instead of result.Name

Thanks :)
This was selected as the best answer
Amanda Byrne- Carolina Tiger RescueAmanda Byrne- Carolina Tiger Rescue
BLESS YOU! worked great.
Prosenjit Sarkar 7Prosenjit Sarkar 7
Thank Carolina :)