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
silvrhawk9silvrhawk9 

System.SObjectException: SObject row was retrieved via SOQL without querying the requested field:

When i go to edit the record i am now showing this error message

 

anyone have any ideas?

the part of the code giving me trouble is in red

 

<apex:page standardController="Call_crm__c"
    extensions="CallInteractionExtension" id="CallDetail" tabstyle="Call_crm__c">
<body onload="document.CallDetail:Form:PageBlock:PageBlockSection:Address:AddressList.focus();">
<apex:includeScript value="{!$Resource.jQuery}/jquery-validate/jquery-1.4.4.min.js" />
 <apex:form id="Form">
 <apex:outputpanel id="err">
    <apex:pagemessages />
 </apex:outputpanel>   
 <apex:actionStatus startText="Saving..." id="callstatus" />
 
 <apex:pageBlock mode="detail" id="PageBlock" >
 <apex:pageBlockSection columns="1">
    <apex:outputPanel >
     <table width="100%">
       <tr>
         <td style="width:12%" colspan="4">
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton action="{!cancel}" value="Cancel" immediate="true"/>
          </td>
       </tr>

       <tr>

         <td class="labelCol" style="width:10%">Account Type  </td>

         <td style="width:15%">
            <apex:outputfield value="{!interaction.Account_crm__r.Account_Type_ods__c}" />
         </td>

         <td class="labelCol" style="width:10%">Specialty</td>

         <td style="width:15%"><apex:outputfield value="{!interaction.Account_crm__r.Specialty_ods__c}" /></td>

         <td class="labelCol" style="width:10%;">Methodolgy</td >

         <td style="width:33%"><apex:outputfield value="{!interaction.Account_crm__r.Methodolgy_crm__c}" />&nbsp;</td>
         </tr>
        
         <tr>
         <td class="labelCol" style="width:10%">Territory  
         </td>
         <td style="width:15%">
            <apex:outputfield value="{!interaction.Territory_crm__c}" />
         </td>
        
         <td class="labelCol" style="width:10%">Created By  
         </td>
         <td style="width:15%">
            <apex:outputText value="{!CreatedByInfo}" />
         </td>
       
        <td colspan="2" />
        
         </tr>
        
         </table>
      </apex:outputPanel>
 </apex:pageBlockSection>
 
  
  <apex:pageblocksection title="Interaction Details" id="PageBlockSection"  collapsible="true" columns="3">
    <apex:pageblocksectionitem >
     <apex:outputlabel value="Account Name" />
     <apex:outputfield value="{!interaction.Account_crm__r.Name}" />
    </apex:pageblocksectionitem>
            <apex:pageblocksectionitem id="attendeepbs">         
              <apex:outputpanel layout="block">
               <table>
                    <tbody><tr>
                    <td>
                     <select multiple="multiple" size="5" id="attendeelist" name="selSea">
                       <apex:repeat value="{!listcallAttendee}" var="ca">
                         <option value="{!ca.affiliationCrm.To_Account_crm__c}">{!JsEncode(ca.affiliationCrm.To_Account_crm__r.Name)} {!JsEncode(ca.affiliationCrm.Type_crm__c)}</option>
                       </apex:repeat>     
                     </select>
                    </td>
                    <td>
                     <input onclick="GLAttendee.addAttendee();" value="Add" class="btn" type="button"/>
                    </td>
                    </tr>
                    </tbody></table>
                    <div id="listAddedAttendee">
                     <table>
                      <tbody id="attendeebody">
                        <apex:repeat value="{!addedlistcallAttendee}"  var="ca">
                            <tr id="td_{!ca.affiliationCrm.To_Account_crm__c}">
                                <td>{!ca.affiliationCrm.To_Account_crm__r.Name} {!ca.affiliationCrm.Type_crm__c}</td>
                                <td><input type="button" class="btn" onclick="GLAttendee.deleteAttendee('{!JsEncode(ca.affiliationCrm.To_Account_crm__r.Name)} {!JsEncode(ca.affiliationCrm.Type_crm__c)}','{!ca.affiliationCrm.To_Account_crm__c}');" value="X"/></td>
                            </tr>
                        </apex:repeat>  
                    </tbody></table>
                    </div>                 
                    <apex:inputhidden id="addedCallAttendee" value="{!addedCallAttendee}"/>
                    <apex:inputhidden id="deletedCallAttendee" value="{!deletedCallAttendee}"/>
              </apex:outputpanel>
            </apex:pageblocksectionitem>
     
     <apex:pageblocksectionitem />
     <apex:pageblocksectionitem >
       <apex:outputlabel value="Interaction Date Time"/>
           <apex:outputpanel >
                   <apex:inputfield value="{!contact.BirthDate}" required="true"/>
                    <apex:selectList value="{!timestamp}" size="1">
                    <apex:selectOptions value="{!timeList}"/>
                </apex:selectList>                  
           </apex:outputpanel>
     </apex:pageblocksectionitem>

  
   
    <apex:inputfield value="{!interaction.Status_crm__c}" required="true" />    
     <apex:inputfield value="{!interaction.Completed_crm__c}" />
    
     <apex:pageblocksectionitem id="Address">
     <apex:outputlabel value="Address" />
      <apex:selectList id="AddressList" value="{!interaction.Address_crm__c}"  size="1">
            <apex:selectOptions value="{!listOfAddress}"/>
        </apex:selectList>
    </apex:pageblocksectionitem>
   
     <apex:pageblocksectionitem >
       <apex:outputlabel value="Call Report Type"/>
      <apex:inputfield value="{!interaction.Call_Report_Type_crm__c}" />
     </apex:pageblocksectionitem>
   
   
   
    <!-- commented on 03/05/2011 guruk
    <apex:pageblocksectionitem rendered="{!IF(userTrs.size > 1 , true,false)}">
     <apex:outputlabel value="Territory" />
      <apex:selectList value="{!interaction.Territory_crm__c}"  size="1">
            <apex:selectOptions value="{!userTrs}"/>
        </apex:selectList>
    </apex:pageblocksectionitem>  
   -->
  
  </apex:pageblocksection>

<apex:pageblocksection title="Call Notes"   collapsible="true" columns="1">
 <apex:outputpanel >
    <table width="100%" >
          <tr>
            <td class="labelCol" style="text-align:left">
             Notes:
            </td>
          </tr>
          <tr>
            <td>
             <apex:inputTextarea value="{!interaction.Call_Note_crm__c}" rows="4" cols="140"/>
            </td>
          </tr>                 
           <tr>
            <td class="labelCol" style="text-align:left">
             Next Call Strategy:
            </td>
           </tr>
           <tr>
            <td style="width:250px">
             <apex:inputTextarea value="{!interaction.Next_Call_Strategy_crm__c}" rows="4" cols="140"/>
            </td>
          </tr>
        </table>
 </apex:outputpanel>

</apex:pageblocksection>
 
  <apex:pageblocksection Title="Cross-Sell/Up-Sell" collapsible="true" >
   <apex:inputfield value="{!interaction.Upsells__c}" />
   <apex:inputfield value="{!interaction.Cross_Sells__c}" />
  </apex:pageblocksection>
 
<apex:pageblocksection Title="Follow-up Actions" collapsible="true" columns="1" id="followupBlock">
   <apex:PageblockSectionItem >
   <apex:outputpanel >
      <table width="100%" >    
      
          <apex:repeat value="{!existingCallTask}" var="callTask">
           <tr>
           <td class="labelCol">
                  {!callTask.callTaskCrm.Followup_Task_Type_crm__r.Name}
            </td>
            <td>           
             <apex:inputcheckbox value="{!callTask.isSelected}" />
            </td>
             <td class="labelCol">
                 Date Completed
            </td>
            <td>           
             <apex:inputfield value="{!callTask.callTaskCrm.DateCompleted_crm__c}" />
            </td>
           </tr>          
          </apex:repeat>         
        </table>  
   </apex:outputpanel>
  
   </apex:PageblockSectionItem>

</apex:PageblockSection>

<apex:pageblockSection Title="Price Quote and Proposal" collapsible="true" columns="1">
<apex:outputpanel >
 <table width="100%" >
          <tr>
            <td class="labelCol">
        

Best Answer chosen by Admin (Salesforce Developers) 
aballardaballard

Looks like interaction is being read in this part of the code:

 

for(Call_crm__c callcrm : [Select Territory_crm__c, Status_crm__c, Start_Date_Time_crm__c,
Call_Note_crm__c,Name, Meal_Expense_crm__c, Meal_Expense_Notes_crm__c,
Meal_Expense_Amount_crm__c, Id, End_Date_Time_crm__c,
Description_crm__c, All_Day_crm__c, Address_crm__c,
Actual_Attendees_crm__c, Account_crm__c,Completed_crm__c,Planned_Attendees_crm__c,
CreatedDate,
Account_crm__r.New_Territory_crm__c,
Account_crm__r.Name,Account_crm__r.Account_Type_ods__c,Next_Call_Strategy_crm__c,
Account_crm__r.Methodolgy_crm__c,Account_crm__r.Specialty_ods__c,
CreatedBy.Name,
Call_Report_Type_crm__c
From Call_crm__c
Where id =:stdCon.getId()]){
interaction = callcrm;

 

 

You need to update the list of fields being read to include upsells__c and crossellls__c

All Answers

aballardaballard

Is "interaction" being loaded by SOQL in your controller extension?   It sounds like you are just not reading the referenced fields. 

silvrhawk9silvrhawk9

How would I find this out?

I have taken over doing this from an outside company. We are just trying to make a few changes to the pages.

Any help is greatly appreciated

 

aballardaballard

Can you post the code for the controller extension "CallInteractionExtension"

silvrhawk9silvrhawk9

public class CallInteractionExtension {
public User usr {get;set;}
public Account nonPersonAccount {get;set;}
public Call_crm__c interaction {get;set;}
public List<Selectoption> listOfAddress {get;set;}
public Map<String,Ref_Call_Attendee_crm__c> existingCallAttendee {get;set;}
public transient Map<String,CallTask> existingCallTaskMap{get;set;}
public Map<String,Call_Product_Detail_crm__c> existingCallProduct {get;set;}
public List<String> followuptaks {get;set;}
public List<Selectoption> userTrs {get;set;}
public List<SelectOption> followUpType {get;set;}
public Boolean isSaved {get;set;}
public Price_Quote_Activity_crm__c callPriceActivity {get;set;}
public List<CallTask> existingCallTask{get;set;}
public Boolean isProposalSelected {get;set;}
public Contact contact {get;set;}
public List<Selectoption> timeList {get;set;}
public String timestamp {get;set;}
public String addedCallAttendee {get;set;}
public String deletedCallAttendee {get;set;}

public String CreatedByInfo { get; set; }

//Key=> AccountId
public transient Map<String,CallAttendee> mapCallAttendee {get;set;}
public List<CallAttendee> listcallAttendee {get;set;}
public List<CallAttendee> addedlistcallAttendee {get;set;}

//Product Line Info
public List<ProductLineInfo> productLineInfos {get;set;}

public CallInteractionExtension(Apexpages.Standardcontroller stdCon){
usr = [Select u.TimeZoneSidKey From User u Where id=:UserInfo.getUserId() limit 1];
existingCallTask = new List<CallTask>();
addedCallAttendee = deletedCallAttendee = '';
listcallAttendee = new List<CallAttendee>();
mapCallAttendee = new Map<String,CallAttendee>();
addedlistcallAttendee = new List<CallAttendee>();

getTimeStamp();
contact = new Contact();
existingCallTaskMap = new Map<String,CallTask>();
isProposalSelected = false;
isSaved = false;
callPriceActivity = new Price_Quote_Activity_crm__c();
followuptaks = new List<String>();
existingCallAttendee = new Map<String,Ref_Call_Attendee_crm__c>();
existingCallProduct = new Map<String,Call_Product_Detail_crm__c>();
if(Apexpages.currentPage().getParameters().get('accountId') != null
&& Apexpages.currentPage().getParameters().get('accountId') != ''){
String accId = Apexpages.currentPage().getParameters().get('accountId');
for(Account acc : [Select id,New_Territory_crm__c, Name,Account_Type_ods__c,Methodolgy_crm__c
,Specialty_ods__c FROM Account Where id =:accId limit 1 ]){
nonPersonAccount = acc;
}

interaction = new Call_crm__c(Account_crm__r = nonPersonAccount );
}

if(stdCon.getId() != null){
for(Call_crm__c callcrm : [Select Territory_crm__c, Status_crm__c, Start_Date_Time_crm__c,
Call_Note_crm__c,Name, Meal_Expense_crm__c, Meal_Expense_Notes_crm__c,
Meal_Expense_Amount_crm__c, Id, End_Date_Time_crm__c,
Description_crm__c, All_Day_crm__c, Address_crm__c,
Actual_Attendees_crm__c, Account_crm__c,Completed_crm__c,Planned_Attendees_crm__c,
CreatedDate,
Account_crm__r.New_Territory_crm__c,
Account_crm__r.Name,Account_crm__r.Account_Type_ods__c,Next_Call_Strategy_crm__c,
Account_crm__r.Methodolgy_crm__c,Account_crm__r.Specialty_ods__c,
CreatedBy.Name,
Call_Report_Type_crm__c
From Call_crm__c
Where id =:stdCon.getId()]){
interaction = callcrm;
nonPersonAccount = interaction.Account_crm__r;
if(interaction.Start_Date_Time_crm__c != null){
contact.BirthDate = interaction.Start_Date_Time_crm__c.date();
timestamp = interaction.Start_Date_Time_crm__c.format('kk:mm',usr.TimeZoneSidKey);
system.debug('____________timestamp____________'+timestamp);
}
if ( interaction != null )
CreatedByInfo = interaction.createdby.name + ' ' + interaction.createdDate.date().format();
}
} else {
CreatedByInfo = UserInfo.getName();
if (nonPersonAccount.New_Territory_crm__c != null)
interaction.Territory_crm__c = nonPersonAccount.New_Territory_crm__c;
}


if(interaction.id != null){
getExistingCallProduct();
}


initliaze();

if(interaction.id != null){
getExistingData();
}
}

private void initliaze(){

/* commented on 03/05/2011
userTrs = new List<Selectoption>();
for(Territory terriotory :[Select Name, Id
From Territory
where id IN
(Select TerritoryId
From UserTerritory
where UserId =: UserInfo.getUserId()
)]){
userTrs.add(new Selectoption(terriotory.Name,terriotory.Name));
}
*/

followUpType = new List<SelectOption>();
for(Followup_Task_Type_crm__c followUpTask : [Select Name, Id, Home_Office_Tasks__c
From Followup_Task_Type_crm__c
order by Display_Order_crm__c asc]){
CallTask calltask = new CallTask(new Call_Task_crm__c(Followup_Task_Type_crm__r = followUpTask));
calltask.callTaskCrm.Followup_Task_Type_crm__c = followUpTask.id;
calltask.callTaskCrm.Subject_crm__c = followUpTask.Name;
calltask.callTaskCrm.Name = followUpTask.Name;
calltask.callTaskCrm.Home_Office_Task__c = followUpTask.Home_Office_Tasks__c;

existingCallTask.add(calltask);
existingCallTaskMap.put(followUpTask.id,calltask);
}
if(interaction.status_crm__c == null){
interaction.status_crm__c = 'In Office';
}

/* commented on 03/05/2011
if(userTrs.size()>0 && (interaction.id == null || interaction.Territory_crm__c == null)){
interaction.Territory_crm__c = userTrs[0].getValue();
}
*/

getAccountAffilcation();
getAddress();


//Prepare ProductLines
productLineInfos = new List<ProductLineInfo>();
List<Product_Line_crm__c> productLinecrms = [Select Name,Display_Caption_crm__c, Id From Product_Line_crm__c order by Display_Order_crm__c asc ];
Map<Id,ProductLineInfo> mapProductLinecrms = new Map<Id,ProductLineInfo>();
for(Product_Line_crm__c plc :productLinecrms ){
ProductLineInfo pli = new ProductLineInfo(plc);
productLineInfos.add(pli);
mapProductLinecrms.put(plc.id,pli);
}

for(Product_crm__c pc :[Select Product_Line_crm__c, Name, Id, Display_Order_crm__c
From Product_crm__c
Where Product_Line_crm__c IN :productLinecrms
order by Display_Order_crm__c asc ]){
mapProductLinecrms.get(pc.Product_Line_crm__c).addProducts(pc,existingCallProduct);
//mapProductLinecrms.get(pc.Product_Line_crm__c).listProductCrm.add(new ProductCrm(pc));
}
}



void getTimeStamp(){
timeList = new List<Selectoption>();
//timestamp = '';
Datetime currentDate = system.now();
timestamp = currentDate.format('kk', usr.TimeZoneSidKey) + ':00';

for(Integer i = 0 ; i< 12 ; i++){
for(Integer j = 0 ; j < 4 ; j++){
String hourValue = getFormattedString(i);
String minuteValue = getFormattedString((j * 15));
timeList.add( new Selectoption(hourValue + ':' + minuteValue, hourValue + ':' + minuteValue +' AM'));
}
}
for(Integer i = 0 ; i< 12 ; i++){
for(Integer j = 0 ; j < 4 ; j++){
String hourValue = getFormattedString(i);
if(i == 0){
hourValue = getFormattedString(i + 12);
}
String minuteValue = getFormattedString((j * 15));
timeList.add( new Selectoption((i+12).format() + ':' + minuteValue, hourValue + ':' + minuteValue +' PM'));
}
}
}

private String getFormattedString(Integer intValue){
if(String.valueOf(intValue).length() ==1){
return '0' + String.valueOf(intValue);
}
return String.valueOf(intValue);
}

void getAccountAffilcation(){
for(Affiliation_crm__c affiliation : [Select To_Account_crm__r.Type,
To_Account_crm__c,To_Account_crm__r.Name,Type_crm__c
From Affiliation_crm__c
Where Account_crm__c =:nonPersonAccount.id
and To_Account_crm__r.Account_Type_ods__c ='Provider'
]){
CallAttendee ca = new CallAttendee(affiliation);
listcallAttendee.add(ca);
mapCallAttendee.put(affiliation.To_Account_crm__c,ca);
}
system.debug('________listcallAttendee'+listcallAttendee);
}

void getAddress(){
listOfAddress = new List<Selectoption>();
for(Address_ods__c address : [Select Name,id
From Address_ods__c
Where Account_ods__c = :nonPersonAccount.id]){
listOfAddress.add(new Selectoption(address.id,address.Name));
}
}

public Pagereference save(){
Pagereference pg = null;


if(interaction.Meal_Expense_crm__c == true && (interaction.Meal_Expense_Amount_crm__c == null || interaction.Meal_Expense_Amount_crm__c == 0)){
Apexpages.addMessage( new ApexPages.Message(ApexPages.Severity.ERROR, 'Meal Expense Amount can not be zero'));
return null;
}else{

System.SavePoint sp = Database.setSavepoint();
try{
//Integer tstamp = Integer.valueOf(timestamp);

// guruk: use current user timezone
// interaction.Start_Date_Time_crm__c = Datetime.newInstanceGmt(contact.BirthDate,Time.newInstance(Integer.valueOf(timestamp.split(':')[0]), Integer.valueOf(timestamp.split(':')[1]), 0, 0));

interaction.Start_Date_Time_crm__c = Datetime.newInstance(contact.BirthDate,Time.newInstance(Integer.valueOf(timestamp.split(':')[0]), Integer.valueOf(timestamp.split(':')[1]), 0, 0));

interaction.End_Date_Time_crm__c = interaction.Start_Date_Time_crm__c.addMinutes(15);
interaction.Account_crm__c = nonPersonAccount.id;
interaction.Description_crm__c = '';
upsert interaction;

if(callPriceActivity.id == null){
callPriceActivity.Call_crm__c = interaction.id;
callPriceActivity.Account_crm__c = nonPersonAccount.id;
callPriceActivity.Name = nonPersonAccount.Name;
}

system.debug('---callPriceActivity--'+callPriceActivity);


/*
for(String s : attendees){
if(! existingCallAttendee.containsKey(s)){
callAttendees.add(new Ref_Call_Attendee_crm__c(Account_crm__c = s,Call_crm__c = interaction.id ));
}
existingCallAttendee.remove(s);
}
*/
system.debug('______________addedCallAttendee__'+addedCallAttendee);
List<Ref_Call_Attendee_crm__c> callAttendeesToDelete = new List<Ref_Call_Attendee_crm__c>();
List<Ref_Call_Attendee_crm__c> callAttendeesToInsert = new List<Ref_Call_Attendee_crm__c>();
for(CallAttendee ca : addedlistcallAttendee){
if(deletedCallAttendee.indexOf(ca.affiliationCrm.To_Account_crm__c) != -1){
callAttendeesToDelete.add(ca.refCallAttendee);
}
addedCallAttendee = addedCallAttendee.replace(ca.affiliationCrm.To_Account_crm__c, '');
}

for(CallAttendee ca : listcallAttendee){
if(addedCallAttendee.indexOf(ca.affiliationCrm.To_Account_crm__c) != -1){
callAttendeesToInsert.add(new Ref_Call_Attendee_crm__c(Account_crm__c = ca.affiliationCrm.To_Account_crm__c,Call_crm__c = interaction.id ));
}
}

List<Call_Task_crm__c> callTaskToInsert = new List<Call_Task_crm__c>();
List<Call_Task_crm__c> callTaskToDelete = new List<Call_Task_crm__c>();
for(CallTask calltask : existingCallTask){

Call_Task_crm__c calltaskcrm = calltask.callTaskCrm;

if(calltaskcrm.id == null){
calltaskcrm.Call_Crm__c =interaction.id;
calltaskcrm.Assigned_To_crm__c = Userinfo.getUserId();
}

// capture completed by guruk 3/5/2011

if ( calltaskcrm.datecompleted_crm__c != null &&
calltaskcrm.completed_by_crm__c == null ) {
calltaskcrm.completed_by_crm__c = Userinfo.getUserId();
}

if(calltaskcrm.Date_crm__c == null){
calltaskcrm.Date_crm__c = interaction.Start_Date_Time_crm__c.adddays(7).date();
}

if(calltask.isSelected){
// add account reference
calltaskcrm.account_crm__c = nonPersonAccount.id;
callTaskToInsert.add(calltaskcrm);
}else if(calltask.isSelected == false && calltaskcrm.id != null){
callTaskToDelete.add(calltaskcrm);
}

}

List<Call_Product_Detail_crm__c> callProductsToInsert = new List<Call_Product_Detail_crm__c>();
for(ProductLineInfo pli: productLineInfos){
for(String s : pli.selectedProductListLeft){
if(! existingCallProduct.containsKey(s)){
callProductsToInsert.add(new Call_Product_Detail_crm__c(
Product_Info_crm__c =s, Call_crm__c = interaction.id));
}
existingCallProduct.remove(s);
}

for(String s : pli.selectedProductListRight){
if(! existingCallProduct.containsKey(s)){
callProductsToInsert.add(new Call_Product_Detail_crm__c(
Product_Info_crm__c =s, Call_crm__c = interaction.id));
}

existingCallProduct.remove(s);
}
}

if(isProposalSelected == true){
upsert callPriceActivity;
}else if(isProposalSelected == false && callPriceActivity.id != null){
delete callPriceActivity;
}
//upsert callAttendees;
//delete existingCallAttendee.values();
upsert callTaskToInsert;
delete callTaskToDelete;
upsert callProductsToInsert;
delete existingCallProduct.values();
upsert callAttendeesToInsert;
delete callAttendeesToDelete;

//Select r.Call_crm__c, r.Account_crm__r.Name, r.Account_crm__c From Ref_Call_Attendee_crm__c r
//

String str= nonPersonAccount.Name;
for(Ref_Call_Attendee_crm__c refCalls : [select id,Name,Account_crm__r.Name from Ref_Call_Attendee_crm__c Where Call_crm__c =:interaction.id AND Account_crm__c <> null] ){
str += str == '' ? '' : ', ';
str += refCalls.Account_crm__r.Name;
}
interaction.description_crm__c = str;

String productString = '';
String productLine = '';
for(Call_Product_Detail_crm__c callProduct : [select Product_Info_crm__r.Display_Order_crm__c
,Product_Info_crm__r.Name,Product_Info_crm__r.Product_Line_crm__r.Name,Product_Info_crm__r.Product_Line_crm__r.Display_Caption_crm__c
FROM Call_Product_Detail_crm__c
Where Call_crm__c =:interaction.id AND Product_Info_crm__c <> null
Order by Product_Info_crm__r.Product_Line_crm__r.Display_Caption_crm__c asc,Product_Info_crm__r.Display_Order_crm__c asc] ){
if(productLine != callProduct.Product_Info_crm__r.Product_Line_crm__r.Name ){
productLine = callProduct.Product_Info_crm__r.Product_Line_crm__r.Name;
productString += productLine +': ';
}
productString += callProduct.Product_Info_crm__r.Name +',';
}
if(productString!= ''){
//productString.substring(0,productString.lenth);
productString = productString.substring(0,productString.length()-2) +'.';
}
interaction.Detailed_Products_crm__c = productString;

update interaction;
//sp.commit();

pg = new Pagereference('/' + nonPersonAccount.id);
isSaved = true;
}catch(Exception e){
Database.rollback(sp);
Apexpages.addMessages(e);
}
}
return pg;
}

private void getExistingData(){
//listCallTask = new List<CallTask>();
followuptaks = new List<String>();


for(Call_Task_crm__c ctcrm : [Select Followup_Task_Type_crm__c, Call_crm__c,Comments_crm__c,DateCompleted_crm__c
,Assigned_To_crm__c ,Followup_Task_Type_crm__r.Name,Date_crm__c,Subject_crm__c,
Completed_By_crm__c
From Call_Task_crm__c
Where Call_crm__c=: interaction.Id AND Followup_Task_Type_crm__c <> NULL]){
existingCallTaskMap.get(ctcrm.Followup_Task_Type_crm__c).setCallTask(ctcrm);

}

for(Ref_Call_Attendee_crm__c refCalls : [select id,Name,Account_crm__r.Name
from Ref_Call_Attendee_crm__c
Where Call_crm__c =:interaction.id]){
existingCallAttendee.put(refCalls.Account_crm__c,refCalls);
mapCallAttendee.get(refCalls.Account_crm__c).refCallAttendee = refCalls;
addedlistcallAttendee.add(mapCallAttendee.get(refCalls.Account_crm__c));
addedCallAttendee += ','+ refCalls.Account_crm__c;
mapCallAttendee.remove(refCalls.Account_crm__c);
}

listcallAttendee = mapCallAttendee.values();

for(Price_Quote_Activity_crm__c pqa : [Select Proposal_Action_crm__c, Name,
Date_Sent_crm__c, Date_Expired_crm__c, Date_Declined_crm__c,
Date_Accepted_crm__c, Call_crm__c, Account_crm__c
From Price_Quote_Activity_crm__c
Where Call_crm__c =:interaction.id limit 1]){
callPriceActivity = pqa;
isProposalSelected = true;
}

}



private void getExistingCallProduct(){
for(Call_Product_Detail_crm__c callProduct : [Select c.Product_Info_crm__c, c.Call_crm__c
From Call_Product_Detail_crm__c c
Where Call_crm__c =:interaction.id]){
existingCallProduct.put(callProduct.Product_Info_crm__c,callProduct);
}
}

public Pagereference cancel(){
return new Pagereference('/' + nonPersonAccount.id);
}

public class CallTask{
public Call_Task_crm__c callTaskCrm {get;set;}
public Boolean isSelected {get;set;}
public Boolean isAlreadySelected {get;set;}

public CallTask(Call_Task_crm__c callTaskCrm){
this.callTaskCrm = callTaskCrm;
}

public void setCallTask(Call_Task_crm__c callTaskCrm){
this.callTaskCrm = callTaskCrm;
this.isSelected = true;
this.isAlreadySelected = true;
}
}

public class CallAttendee{
public Ref_Call_Attendee_crm__c refCallAttendee {get;set;}
public Affiliation_crm__c affiliationCrm {get;set;}

public CallAttendee(Affiliation_crm__c affiliationCrm){
this.affiliationCrm = affiliationCrm;
this.refCallAttendee = null;
}
}

public class ProductLineInfo{
public Product_Line_crm__c productline {get;set;}
public List<Selectoption> productListleft {get;set;}
public List<Selectoption> productListRight {get;set;}
public Integer index ;
public List<String> selectedProductListLeft {get;set;}
public List<String> selectedProductListRight {get;set;}
//public List<ProductCrm> listProductCrm {get;set;}

public ProductLineInfo(Product_Line_crm__c productline ){
this.productline = productline;
//this.productList = productList;
this.productListleft = new List<SelectOption>();
this.productListRight = new List<SelectOption>();
this.selectedProductListLeft = new List<String>();
this.selectedProductListRight = new List<String>();
index = 0;
//this.listProductCrm = new List<ProductCrm>();
}

public void addProducts(Product_crm__c product,Map<String,Call_Product_Detail_crm__c> existingCallProduct){
if(Math.mod(index,2) == 0){
this.productListleft.add(new SelectOption(product.id,product.Name));
if(existingCallProduct.containsKey(product.id)){
this.selectedProductListLeft.add(product.id);
}
}else{
this.productListRight.add(new SelectOption(product.id,product.Name));
if(existingCallProduct.containsKey(product.id)){
this.selectedProductListRight.add(product.id);
}
}
index++;
}
}
}

Shashikant SharmaShashikant Sharma

Check all your SOQL there is one field that you are not querying and accessing it in VFP or in Controller

 

Like

 Account a = [Select id from Account limit 1];

String accName = a.Name;

 

in this example I did not query Name but accessed it.

 

If you could share the controller will be helpful to trace it.

aballardaballard

Looks like interaction is being read in this part of the code:

 

for(Call_crm__c callcrm : [Select Territory_crm__c, Status_crm__c, Start_Date_Time_crm__c,
Call_Note_crm__c,Name, Meal_Expense_crm__c, Meal_Expense_Notes_crm__c,
Meal_Expense_Amount_crm__c, Id, End_Date_Time_crm__c,
Description_crm__c, All_Day_crm__c, Address_crm__c,
Actual_Attendees_crm__c, Account_crm__c,Completed_crm__c,Planned_Attendees_crm__c,
CreatedDate,
Account_crm__r.New_Territory_crm__c,
Account_crm__r.Name,Account_crm__r.Account_Type_ods__c,Next_Call_Strategy_crm__c,
Account_crm__r.Methodolgy_crm__c,Account_crm__r.Specialty_ods__c,
CreatedBy.Name,
Call_Report_Type_crm__c
From Call_crm__c
Where id =:stdCon.getId()]){
interaction = callcrm;

 

 

You need to update the list of fields being read to include upsells__c and crossellls__c

This was selected as the best answer
silvrhawk9silvrhawk9

That was it. Thank you soo much for your help.