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
BobHBobH 

How do I retrieve a user-defined field in Accounts

Hi all,

I'm new to SalesForce.  I have been messing around with the API the last few days.  I have managed to write code to insert a new contact and account.  I also played around with querying data in accounts.  But I am stumped on something.  We have created several user-defined fields in accounts.  By reading thru various posts I see that you must append __C at the end of custom fields.  So here is my SQL statement:

 

qra = binding.query("select Name, Site, Id, Bed_Count__c from Account")  Bed_Count is the user defined field.  I would like to display this field.  How do I do this?

 

Thanks,

Bob

JesipJesip

I assume that "qra" is your QueryResult object.

The QueryResult contains a records array (if using the Enterprise WSDL).  You can convert the items in the record array to an Account object and then simply extract the "Bed Count" out of the Account object.

dim sfAccount as Account

sfAccount = qra.records(0)

response.write(sfAccount.Bed_Count__C)

BobHBobH

Thanks for the reply.  That is exactly what I tried.  I should have displayed all my code.  But Bed_Count is not a property of Account.  That is my problem.  Only the predefined fields in Account show up. 

 

Thanks,

Bob

SuperfellSuperfell
You need to re-generate your WSDL from the system, it'll pick up all the new fields.
BobHBobH

Thanks,

 

That did the trick.

 

Bob