无法从Salesforce QueryResult C#获取sObject ID

时间:2019-07-03 08:33:00

标签: c# wsdl salesforce

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 ++)
      {
          sObject acc = records[i];
          accountId = acc.id; // record id is null here
      }

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

0 个答案:

没有答案