You need to sign in to do that
Don't have an account?
Gaurav Agnihotri 11
class instance variable not showing in VF page
I want to display result from Opportunity class and custom class Opportunity_Split_Reporting_Lens__c which is the child of Opportunity class.
For that I created a class OpporutnityEdit as a place holder:
However, when I call the list of opporuntyEdit Values, I get an error message.
VF page
Error 4 Unknown property 'OpporutnityEdit.oppName'
not sure why the property is unknown. it is defined in the class:
public class OpporutnityEdit
{
public string oppName;
public id oppId;
Any suggestions?
For that I created a class OpporutnityEdit as a place holder:
public class OpporutnityEdit { public string oppName; public id oppId; public string accountName; public date closeDate; public string stage; public string forecast; public string totalARR_USD; public string oppSplitUser; public string totalSaleQuota_USD; public string commissionSplitPercentage; public string nextSeps; public string sub_SubTeamofSplit; public string best_Likely_Worst; public string rSDComments; public string aVP_VPComments; public list<OpporutnityEdit> createOppEditList( List<Opportunity_Split_Reporting_Lens__c> oppSplits) { list<OpporutnityEdit> newOppEdits = new list<OpporutnityEdit>(); for (Opportunity_Split_Reporting_Lens__c newOppSplit: oppSplits) { OpporutnityEdit newOppEdit = new OpporutnityEdit() ; newOppEdit.oppId = newOppSplit.Opportunity_Name__r.Id ; newOppEdit.oppName = newOppSplit.Opportunity_Name__r.name; newOppEdit.accountName = newOppSplit.Opportunity_Account_Name__c; newOppEdit.closeDate = newOppSplit.Opportunity_Name__r.CloseDate; newOppEdit.stage = newOppSplit.Opportunity_Name__r.StageName; newOppEdit.forecast = newOppSplit.Opportunity_Name__r.Forecast__c; //newOppEdit.totalARR_USD = newOppSplit.Opportunity_Name__r.Total_ARR_USD__c; newOppEdit.oppSplitUser = newOppSplit.Split_User_Sub_Sub_Team_Picklist__c; //newOppEdit.totalSaleQuota_USD = newOppSplit.Total_Sale_USD__c; //newOppEdit.commissionSplitPercentage = newOppSplit.Commission_Split__c; newOppEdit.nextSeps = newOppSplit.Opportunity_Name__r.Next_Steps_Next_Steps_2__c; newOppEdit.sub_SubTeamofSplit = newOppSplit.Split_User_Sub_Sub_Team_Picklist__c; newOppEdit.best_Likely_Worst = newOppSplit.Opportunity_Name__r.Best_Likely_Worst__c; newOppEdit.rSDComments = newOppSplit.Opportunity_Name__r.RSD_Comments__c; newOppEdit.aVP_VPComments = newOppSplit.Opportunity_Name__r.AVP_VP_Comments__c; System.debug(newOppEdit) ; newOppEdits.add(newOppEdit); } System.debug('oppEdit in function'); System.debug(newOppEdits) ; return(newOppEdits); } }In the controller class, I can call this class and populate the value based on some opportunity criteria:
public class OpportunityEditController { public string searchString; public Date startDate { get; set; } public Date endDate { get; set; } public string subSubTeamOfSplit { get; set; } public List<Opportunity_Split_Reporting_Lens__c> oppSplits { get; set; } public List<OpporutnityEdit>newOppEdits { get; set; } public void search() { searchString = 'select id, name,Opportunity_Name__r.Id,Opportunity_Name__r.name, Opportunity_Account_Name__c,Opportunity_Name__r.CloseDate, Opportunity_Name__r.StageName,Opportunity_Name__r.Forecast__c,Opportunity_Name__r.Total_ARR_USD__c, Split_User_Sub_Sub_Team_Picklist__c,Opp_Split_User__c,Total_Sale_USD__c,Commission_Split__c, Opportunity_Name__c,Opportunity_Name__r.Next_Steps_Next_Steps_2__c,Opportunity_Name__r.Best_Likely_Worst__c,Opportunity_Name__r.RSD_Comments__c,Opportunity_Name__r.AVP_VP_Comments__c from Opportunity_Split_Reporting_Lens__c where Opportunity_Name__r.Id != null'; System.debug (startDate); System.debug (endDate); System.debug (subSubTeamOfSplit); System.debug (subSubTeamOfSplit.length()); //searchString = 'select name,Opportunity_Name__r.Id,Opportunity_Name__r.name, Opportunity_Account_Name__c,Opportunity_Name__r.CloseDate, Opportunity_Name__r.StageName,Opportunity_Name__r.Forecast__c,Opportunity_Name__r.Total_ARR_USD__c, Split_User_Sub_Sub_Team_Picklist__c,Opp_Split_User__c,Total_Sale_USD__c,Commission_Split__c, Opportunity_Name__c,Opportunity_Name__r.Next_Steps_Next_Steps_2__c from Opportunity_Split_Reporting_Lens__c where Opportunity_Name__r.Id != null'; if (startDate != null) { searchString += ' AND (Opportunity_Name__r.CloseDate >: startDate)'; } if (endDate != null) { searchString += ' AND (Opportunity_Name__r.CloseDate <: endDate)'; } if (subSubTeamOfSplit != null && subSubTeamOfSplit.length()>0) { searchString += ' AND (Split_User_Sub_Sub_Team_Picklist__c =: subSubTeamOfSplit)'; } searchString += ' Limit 1'; System.debug(searchString); oppSplits = Database.query(searchString); OpporutnityEdit newOppEdit = new OpporutnityEdit(); newOppEdits = newOppEdit.createOppEditList(oppSplits); System.debug(newOppEdits); System.debug(newOppEdits[0]); System.debug(newOppEdits[0].oppName); //System.debug(oppSplits); } public void save() { System.debug(LoggingLevel.INFO,'Test'); System.debug(LoggingLevel.INFO,oppSplits); update(oppSplits); } }
However, when I call the list of opporuntyEdit Values, I get an error message.
VF page
<apex:pageBlockTable value ="{!newOppEdits}" var="oe"> <apex:column value ="{!oe.oppName}"></apex:column> </apex:pageBlockTable>Error message:
Error 4 Unknown property 'OpporutnityEdit.oppName'
not sure why the property is unknown. it is defined in the class:
public class OpporutnityEdit
{
public string oppName;
public id oppId;
Any suggestions?
All Answers
Thanks. That did resolve the issue. However, learned an important lesson that <apex:outputfield can only be used with SOBject :)
Error 4 Could not resolve the entity from <apex:outputField> value binding '{!oe.oppName}'. <apex:outputField> can only be used with SObjects, or objects that are Visualforce field component resolvable. C:\Users\gagnihotri\Documents\The Welkin Suite\Projects\FullSand-New\FullSand-New\src\pages\OpportunityEdit.page 1 1