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
Alex BiddleAlex Biddle 

Custom fields from Contact returning null in C# application using SOAP API but shows value in developer console

Hi all,

I am developing a console application in C# and have integrated the SalesForce SOAP API into this application, I am trying to retrieve contacts from SalesForce using a SOQL query. I have created 2 custom fields and have set values to these fields on a few test contacts, and can see these values in the developer console when i run the query

"SELECT AccountId, Id, EmailSuppressionStatus__c, SmsSuppressionStatus__c FROM Contact"

I can see the custom field values in the developer console, however, when i run the soql query in my C# application the custom fields are returning null, I have checked the security for the fields and I should be able to read/write to them, in addition, i have regenerated the Enterprise WSDL within my project but the problem still persists.

Does anybody have any idea what the issue could be?

Thank you

 
Best Answer chosen by Alex Biddle
Ramesh DRamesh D
and make sure you include those fields in the query 
sObject[] sObject = retrieveRecords("Id,Contact__c,Program__c,StageName", "Opportunity", ids);

 

All Answers

Ramesh DRamesh D
Hi @Alex,
Which profile you are using to connect salesforce from c# ? you must provide field access for that profile

I hope you find the above solution helpful. If it does mark as best answer to help others too.
Thanks,
Ramesh D
Ramesh DRamesh D
and make sure you include those fields in the query 
sObject[] sObject = retrieveRecords("Id,Contact__c,Program__c,StageName", "Opportunity", ids);

 
This was selected as the best answer
Alex BiddleAlex Biddle
Hi @Ramesh, thank you for the reply, I have since been able to solve the issue your comment helped, I have come across issue now but will put that as a separate question :)
Ramesh DRamesh D
please mark as best answer which helps keep this commuity clean and help others as well.

Thanks