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
dhcrusoedhcrusoe 

Trying to get/display several variables... suggestions? (easy)

Hey all,

 

I'm still relatively green to Visualforce & Apex, coming from the design end (rather than the code end). I'm trying to query an object (query works) and then call two variables into my custom page: lesson_plan__c.id and lesson_plan__c.lastmodifieddate. Here's the code I've been using; maybe I'm missing the obvious, but for some reason, I can't retrieve the data... 

 

 

public class appDetailExtension { public appDetailExtension(ApexPages.StandardController controller) { } Private string ctContactId; Private string apprenticeshipID; Private string lessonPlanID; Private string lastModified; public appDetailExtension(ApexPages.StandardSetController controller) { } public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select Citizen_Teacher__r.Name, Citizen_Teacher__r.Email from CT_Connector__c where Apprenticeships__r.id = :apprenticeshipID])); } return setCon; } set; } public list<CT_Connector__c> getNames() { PageReference pageRef = System.currentPageReference(); apprenticeshipID = pageRef.getParameters().get('id'); return (List<CT_Connector__c>) setCon.getRecords(); } public string getContactid() { PageReference pageRef = System.currentPageReference(); ctContactId = pageRef.getParameters().get('ctContactId'); return ctContactId; } public String getlessonPlanID (){ return lessonPlanID; } public void setlessonPlanID(String v){ lessonPlanID = v; } public String getlastModified (){ return lastModified; } public void setlastModified (String v){ lastModified = v; } Public void setMyValues(){ PageReference pageRef = System.currentPageReference(); apprenticeshipID = pageRef.getParameters().get('id'); try { Lesson_Plan__c myVar = [select Lesson_Plan__c.id, Lesson_Plan__c.lastmodifieddate from Lesson_Plan__c where Lesson_Plan__c.Apprenticeship__r.id = :apprenticeshipID and Lesson_Plan__c.Lesson_Number__c = '1']; lessonPlanID = myVar.id; lastModified = String.valueOf(myVar.lastmodifieddate); } catch(Exception e){ } } }