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

Updating the value of a custom field for Lead

I'm a newbie taking my very first steps, so please bear with me :)


Note: (I'm using the enterprise WSDL file)


We've created some custom fields for Leads, for example:


Field Label: Customer ID
Object Name: Lead
Field Name: Customer_ID
Data Type: Text
API Name: Customer_ID__c



I need to periodically update these values using the API (in Java).


How do I update custom fields?


I was looking for something like:


SObject[] leads = new Lead[1];
Lead lead = new Lead();
Lead oldLead = _leads[oldLeadId];

// and here's where I got stuck since I was expecting something like


// or something like:




I spent the last couple of hours searching the documentation and the web and couldn't figure this out.


I'm sure it's so simple that I'll feel a little stupid once I get it... :)


Thanks for the help! 

Message Edited by pidrus on 06-26-2009 10:25 AM

This line "lead.setCustomer_ID__c(newValue);" should work.


What is it doing that looks wrong?  What are you expecting it to do?



This method is not even available in the Lead class.


The WSDL was generated AFTER the custom fields were added, but none of the custom fields are referenced there, so the corresponding methods in class in package: 'com.sforce.soap.enterprise.sobject' were not created.


I can't imagine I need to manually add a reference to every custom field in the WSDL and the corresponding metho to the class...

Message Edited by pidrus on 06-29-2009 10:13 AM

Once I have downloaded the Enterprise WSDL, I can import it thru my IDE (jDeveloper) to create all the objects, methods, Soap Client, etc.  This process will include any custom fields (newly added or legacy) along with the standard fields in all the objects.


(this may be a quirk with jDeveloper, but I'll add this just in case)

Occasionally it will look like new fields are not added when I do this.  There is a quirk in my IDE where it will sometimes look at an older set of .CLASS files associated with the building of a JAR, instead of looking at the newer set of .CLASS files associated with the new .JAVA source code.  I can quickly diagnose this by chekcing the source and seeing that the getters / seters are there there.  I manually delete the older .CLASS files and then it magically finds the newer ones the next time I recompile or do a build.