+ Start a Discussion
Aaron GilbertsonAaron Gilbertson 

Custom field not visible in API

Have created a few custom fields against Opportunity.

AgencyAccount -> Link to Account record (only accounts deemed as 'agents')
AgencyContact -> Link to contact (only contacts from accounts deemed to be 'agents')

and a couple other date and status fields

all of them work fine except for AgencyContact?

i include it in my SOQL query and it just won't come through - but it doesnt give me an unknown field error either - the results as an array look like this:
stdClass Object ( [Id] => 0067F00000AGqRiQAL [AgencyAccount__c] => 0017F00000MPAwtQAH [AgencyBooking__c] => 1 [AgencyDiscount__c] => 10 [Amount] => 3300 [Campaign] => stdClass Object ( [Id] => [Name] => APGA 50th Anniversary Publication ) [CloseDate] => 2018-03-30 [Contact__c] => 0037F00000K8iH4QAJ [Name] => TAP [OpportunityLineItems] => stdClass Object ( [done] => 1 [queryLocator] => [records] => Array ( [0] => stdClass Object ( [Id] => [CurrencyIsoCode] => AUD [Description] => ERHP [ListPrice] => 3300 [Name] => TAP Early Right Hand Full Page [PricebookEntry] => stdClass Object ( [Id] => [Product2Id] => 01t7F000002rW2mQAE ) [Product2] => stdClass Object ( [Id] => [Name] => Early Right Hand Full Page ) [TotalPrice] => 3300 [UnitPrice] => 3300 ) ) [size] => 1 ) [Owner] => stdClass Object ( [Id] => [Name] => Dave Marsh ) ) SObject Object ( [type] => [fields] => )


query:
Select Id,Contact__c,Amount,CloseDate,Name,Campaign.Name,Owner.Name,AgencyBooking__c,AgencyContact__c,AgencyAccount__c,AgencyDiscount__c,(Select PricebookEntry.Product2Id,TotalPrice,UnitPrice,ListPrice,CurrencyIsoCode,Name,Description,Product2.Name From OpportunityLineItems) From Opportunity WHERE AccountID = '##salesforce_id##' AND StageName='Closed Won' AND Booking_Status__c = NULL

ready for the really weird part?

when i do the same query in the free soql builder app

(https://soqlbuilder.herokuapp.com/)

i get the field data!!!
User-added image

driving me absolutely nuts!!

happy to provde any more code or anything if anyone has questions, but i have run several queries before with no issues

i updated the WSDL file too and in it, the custom field is defined and everything!!
 

Om PrakashOm Prakash
Please check the FLS for field AgencyContact__c for the profile who is not getting AgencyContact__c in result.
It seems user don’t have field view permission.
I believe, in free sql builder tool you are login with System Admin thats why field value is available there in result.
 
Aaron GilbertsonAaron Gilbertson
yeah the user doing the builder tool is the same user the API uses - system admin
Om PrakashOm Prakash
Thanks for update Aaron,
As you specified that WSDL file is already updated then please check something like clear cache
In php we need to clear wsdl cache for avoid simillar issue. Please check if somethig simillar work in your client side code.
//In PHP
ini_set("soap.wsdl_cache_enabled", 0);

 
Aaron GilbertsonAaron Gilbertson
yep tried that, no change
Om PrakashOm Prakash
Then as you told earliear, its really weird .
Let us wait for others opinion over the same.