• John Daly 3
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
I am new to Sales force API integration with .NET and came accross this issue - can't seem to get the sObject id from QueryResult - the id is null, even though a valid record is returned, and I can see the Name field. Any suggestions?
See my query below:

  string queryStr = $"SELECT id, Name FROM Account Where Name = '{name}'";
                QueryResult qResult = _service.query(queryStr);
                bool done = false;

                if (qResult.size > 0)
                {
                    while(!done)
                    {
                        sObject[] records = qResult.records;

                        for(int i = 0; i < records.Length; i ++)
                        {
                            accountId = records[i].id; // record id is null here
                        }

                        if (qResult.done)
                        {
                            done = true;
                        }
                        else
                        {
                            qResult =
_service.queryMore(qResult.queryLocator);
                        }
                    }            
                }
I am new to Sales force API integration with .NET and came accross this issue - can't seem to get the sObject id from QueryResult - the id is null, even though a valid record is returned, and I can see the Name field. Any suggestions?
See my query below:

  string queryStr = $"SELECT id, Name FROM Account Where Name = '{name}'";
                QueryResult qResult = _service.query(queryStr);
                bool done = false;

                if (qResult.size > 0)
                {
                    while(!done)
                    {
                        sObject[] records = qResult.records;

                        for(int i = 0; i < records.Length; i ++)
                        {
                            accountId = records[i].id; // record id is null here
                        }

                        if (qResult.done)
                        {
                            done = true;
                        }
                        else
                        {
                            qResult =
_service.queryMore(qResult.queryLocator);
                        }
                    }            
                }