function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
alivepjcalivepjc 

describeSObject to get all fields problem

Hi,

I'm using describeSObject to get a list of fields and then pass it to a query. I am using the following code, but it doesn't return all the fields (sometimes 225, 216 depending on string formatting) and my query fails. we have 238 fields in the contacts tab. Depending on how I format the string it forms different strings. Is there a limit I am not aware of?

C#

sforce.DescribeSObjectResult res = binding.describeSObject( "Contact" );

for( int i=0; i < res.fields.Length-1; i++ )

{

expr += res.fields[i].name + ", ";

}

expr += res.fields[i-1].name;

qr = binding.query("select expr from Contact where Id = '" + contactid + "'");

help is appreciated.

darozdaroz
Here's one of the C# functions I use to do something similiar...


public static string getFieldList(sForce.DescribeSObjectResult describe)
{
string ret = "";
foreach (sForce.Field fld in describe.fields)
{
if (ret.Length > 0)
ret += ", ";
ret += fld.name;
}
return ret;
}


Give that a try and see how it goes.