• Arindam Mukherjee
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I am new to Apex world. I am using following code:

Qstr = "Select CreatedBy.username FROM Opportunity Where Id = '006i000000M7NP7AAN'";

SObject[] usrObj  = database.query(Qstr);
if (usrObj.size() > 0)
{
        retVal = (String)usrObj[0].get('CreatedBy.username');
}

get operation on usrObj[0] is failing with following error:

Invalid field CreatedBy.username for Opportunity     

Any idea?

Thanks in advance,
Arindam
I am new to Apex world. I am using following code:

Qstr = "Select CreatedBy.username FROM Opportunity Where Id = '006i000000M7NP7AAN'";

SObject[] usrObj  = database.query(Qstr);
if (usrObj.size() > 0)
{
        retVal = (String)usrObj[0].get('CreatedBy.username');
}

get operation on usrObj[0] is failing with following error:

Invalid field CreatedBy.username for Opportunity     

Any idea?

Thanks in advance,
Arindam