• Laviel
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

I'm trying to retrieve the selected picklist item from the Case object, field Status. My objective is to use this value for a condition and eventually set a new one based on a different logic. But my main issue is every time I try to query the selected item for the Case object I encounter this issue:

 

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

 

You may see my sample code below: This is just part of my debugging to atleast display the selected value on the error message, but I could not even get the selected item

 

for (Case c:cases){
            Case parentCase;
            String parentId = c.ParentId;
            String siblings = ' :: ';
            String selectedStat;
            String display='';
            
            List<Case> siblingCases = new List<Case>{};
            parentCase = [select Subject, Id from Case where Case.Id = :parentId];
           
            display = parentCase.Status;
            c.addError(display);

}

  • January 18, 2012
  • Like
  • 0

I'm trying to retrieve the selected picklist item from the Case object, field Status. My objective is to use this value for a condition and eventually set a new one based on a different logic. But my main issue is every time I try to query the selected item for the Case object I encounter this issue:

 

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

 

You may see my sample code below: This is just part of my debugging to atleast display the selected value on the error message, but I could not even get the selected item

 

for (Case c:cases){
            Case parentCase;
            String parentId = c.ParentId;
            String siblings = ' :: ';
            String selectedStat;
            String display='';
            
            List<Case> siblingCases = new List<Case>{};
            parentCase = [select Subject, Id from Case where Case.Id = :parentId];
           
            display = parentCase.Status;
            c.addError(display);

}

  • January 18, 2012
  • Like
  • 0