Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Salesforce by (11.9k points)

We have our system from where we want to push the records (e.g. Contact, Account, Opportunity, etc.) to SalesForce.

To achieve this, we have used ForceToolKit for .NetWe are able to insert\update the records successfully using the ForceToolKit functions.

Example:

dynamic contact = new ExpandoObject();

contact.FirstName = "FirstName";

contact.LastName = "Last";

contact.Email = "[email protected]";

contact.MobilePhone = "1234567890";

var successResponse = await forceClient.CreateAsync("Contact", contactList);

The Issue we are facing is as mentioned below.

In our source system, we have few custom fields which are not a standard field in SalesForce and it can be different for different users.

So, first, we have to map the custom fields between our source system and the SalesForce.

We want to fetch all the fields of SalesForce object in order to map the fields.

We are unable to find any function in ForceToolkitForNet. As described here, we have tried QueryById function by using the dynamic return type, but it is throwing an exception.

var contactFields = await forceClient.QueryByIdAsync<dynamic>("Contact", successResponse.Id);

Exception: "SELECT FROM Contact where Id = '{contactId}' Incorrect syntax near FROM".

What are the ways to get the fields of any object of SalesForce? Can anyone help us in getting the fields of an object using SalesForceToolkit or SalesForceApi?

1 Answer

0 votes
by (32.1k points)
edited by

Actually, SOQL doesn't have a SELECT * FROM Account notion, you need to master the fields beforehand. 

You have a few options here:

You can use "describe" calls. I think your solution is SOAP-based.

Want to become a Salesforce Expert? join Salesforce certification now!!
 

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...