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
jasone.ax373jasone.ax373 

Webservice API - selecting new custom field problem

I am able to select other custom fields of the contact obj, but when I try and select the new custom field I just created, the query does not return the field.  The query does NOT throw an error either.  When I dump the contact fields with:  describeSObject('Contact'), I can see the new custom field I created.  The field is a boolean with a name of "my_new_customField__c" for example.  Any input would be greatly appreciated.
devNut!devNut!
Not sure if this would affect the return results, but did you check the field level security on the field?
jasone.ax373jasone.ax373
Thanks for the reply devNut!, I have checked that out, it is all set to "visible".  The issue is still happening, I have not been able to find a solution yet.
devNut!devNut!
Can you access the field using the data loader?
jasone.ax373jasone.ax373
Yes, I just verified that I am able to pull the data with the Data Loader. I used the exact same query I am attempting with the API.
devNut!devNut!
Update your wsdl ?
jasone.ax373jasone.ax373
Thanks for the suggestion, but it didn't work.  I downloaded the toolkit again and updated the enterprise.wsdl.xml file that the component is using.  That did not work.  I also added a new line in the wsdl for the contact object (customfield__c was already in there):

<element name="customfield__c" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="Opt_In_Inventory_Alerts__c" nillable="true" minOccurs="0" type="xsd:boolean"/>

I also tried changing/removing the nillable and minOccurs properties as the boolean doesn't appear to have them.  Here is a dump of the contact object properties:

[43] => stdClass Object
(
[autoNumber] =>
[byteLength] => 300
[calculated] =>
[caseSensitive] =>
[createable] => 1
[custom] => 1
[defaultedOnCreate] =>
[digits] => 0
[filterable] => 1
[idLookup] =>
[label] => JasonTest
[length] => 100
[name] => JasonTest__c
[nameField] =>
[namePointing] =>
[nillable] => 1
[precision] => 0
[restrictedPicklist] =>
[scale] => 0
[soapType] => xsd:string
[sortable] => 1
[type] => string
[unique] =>
[updateable] => 1
)

[44] => stdClass Object
(
[autoNumber] =>
[byteLength] => 0
[calculated] =>
[caseSensitive] =>
[createable] => 1
[custom] => 1
[defaultedOnCreate] => 1
[digits] => 0
[filterable] => 1
[idLookup] =>
[label] => Opt In Inventory Alerts
[length] => 0
[name] => Opt_In_Inventory_Alerts__c
[nameField] =>
[namePointing] =>
[nillable] =>
[precision] => 0
[restrictedPicklist] =>
[scale] => 0
[soapType] => xsd:boolean
[sortable] => 1
[type] => boolean
[unique] =>
[updateable] => 1
)
These 2 new fields are the ones I added and canNOT get to come through with a simple select statement. However, the default custom fields that came with the developer company select fine.  Anyone from Sales Force have any input?  devNut!, if you still have ideas, I am all ears.  Thanks.
SuperfellSuperfell
I guessing from the dump that you're using PHP with the enterprise API (and for future reference, you'd probably have gotten better results posting in the PHP forum), PHP by default caches the WSDL, so even though you've updated the WSDL file, its still using the old cached one. See http://wiki.apexdevnet.com/index.php/Turning_off_WSDL_cache for details of how to turn off the caching.
jasone.ax373jasone.ax373
SimonF and devNut!, you are the best!  Thanks for your help.  It is now working.  I did need to update the wsdl as devNut! suggested, and it was being cached by PHP as SimonF suggested. I ran the snippet from the wiki referenced by SimonF and it worked like a charm.  Thanks for pointing out the PHP forum, I did not know about that.  Have a good one.