3

I am writing a program which reads data from CSV text files and attempts to upload data into my organization's Salesforce account. I am writing this console application in C# and with my organization's Enterprise WSDL.

I am attempting to insert data from a different CSV file to a standard Salesforce object called "Leads". One field in the CSV file I am reading is called "Assigned to Rep Name" and it corresponds to a custom field in the Leads object called "Assigned_to_Rep_Name__c" which is of type "string" (according to the WSDL, but it is actually a Picklist with Controlling Field being "Department Name" when I open it in Salesforce.)

While I have been successful in upserting this object with mostly correct data, it is apparent that the names of these representatives are already in my organization's instance of Salesforce. Therefore, by me assigning this field to what I have in the CSV, it is inserting duplicate data. I want to assign the field to an already existing vale, since the allowable picklist values have already been hard coded into Salesforce by a previous admin.

How do I programmatically select the correct Picklist value in my code before I upsert the Lead record into Salesforce?

0

As with the Partner API, you will need to use the Enterprise API describleSObject() method to get the metadata for the Lead sObject.

From the DescribeSObjectResult you and find the corresponding Field. The field will have a picklistValues member with the PicklistEntry for each configured picklist value.

| improve this answer | |

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.