• Prashant Ahuja 14
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi All,
    I am having an issue, which I haven't been able to solve.  in my Apex controller, I have a defined a public class as follows:
public class ContactsAndUser {
        public String userName      {get; set;}
        public String userEmail     {get; set;}
        public String userId        {get; set;}
        public String conImage      {get; set;}
        public String role          {get; set;}
    }

I am populating this class from a soql query into an array as follows ( The idea is to populate the List ContactList from users from the Case Object, Opportunity, User, and Contact Object to make a list of everyone associated wtih a deal ):

list<ContactsAndUser> contactList       = new list<ContactsAndUser>();  
              ContactsAndUser newUser = new ContactsAndUser();
              newUser.userEmail    = ownerInfo[0].Email;
              newUser.userName     = ownerInfo[0].Name;
              newUser.userId       = ownerInfo[0].Id;
              newUser.conImage     = ownerInfo[0].SmallPhotoUrl;
              newUser.role         = '[ Case Owner ]';
              contactList.add(newUser);  

When i debug the function (system.debug('LIGHTNING DEBUG ' + contactList);) I see a populated result in the logs, however, the result items are enclosed in [] square brackets instead of {}. i.e. LIGHTNING DEBUG (ContactsAndUser:[conImage=https://ciscosales--gve--c.xx.content.force.com/profilephoto/005/T, role=[ Case Owner ], userEmail=email=example.com@example.com, userId=00580000007IKULAA4, userName=Leads & Prospects Management Site Guest User])
 
In this example above, the response.getReturnValue() on my lightning event comes back empty.

If I run the same against the standard opportunity or case object as follows:

List<Opportunity> opportunities =
                [SELECT Id, Name, CloseDate FROM Opportunity];
        system.debug('LIGHTNING DEBUG ' + opportunities);
        return opportunities;
I notice the debug log returns the result encapulated in {} curly brackets instead of square brackets, and the result is returned in the response.getReturnValue() event.


Sorry for the very detailed description of the issue, but hoping for some input so I can get this working.

Best Regards,

Andrew