This is the first issue I have ran into retrieving data from Salesforce using the SOAP AP.

So I have introduced a custom field which is a checkbox, (lets call it Checked) and I have added it to the Opportunity Object. I regenerated the WSDL and updated it in Visual Studio. Here is the following code I am using to attempt to retrieve the value of the checkbox.

//Perform query calls to get Opportunity records
for (int i = 0; i < opportunityList.Length; i++)
    Opportunity opp = (Opportunity) opportunityList[i];
    bool checkValue = (opp.Checked__c.HasValue) ? (bool) opp.Checked__c : false;
    //other code

Everytime I call this, no matter what, Checked__c is null so opp.Checked__c.HasValue is false. I made sure that the opportunity that I am checking for has the checkbox checked off and it is. Am I missing an important step for a custom field or something? I have done other custom fields before but I have never ran into anything like this.

  • Are you including that field in the SoQL query you used for data retrieval? – Sebastian Kessel Oct 26 '18 at 17:28
  • 5
    Can you check field level security for that Profile which is accessing that field in c# have access to that field? – Pranay Jaiswal Oct 26 '18 at 17:28
  • 1
    @PranayJaiswal Yup that did it. None of the visible checkboxes were checked off for the field and field access was not editable. Not sure what happened there, never had to do that before for the custom fields – Degausser Oct 26 '18 at 17:34

If A profile user is trying to access a field does not have Field Level Security permission then he wont be able to access that field via API or any standard SF implementation.

Solution: Provide FLS for that profile and that field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.