I am successfully creating a Task using the SalesForce API SOAP API through Java.
However, my problem is that I can\'t seem to set the Type of it. They all default to \
The API field name that contains 'Call' (and defaults to it) is a ComboBox
, not a PickList
, and it's called Subject.
Task.Subject = 'Email';
If you want to set the default, do it from within the Salesforce app:
Setup->Customize->Activities->Task Fields->Subject
This field is available through API like any other. Your problem doesn't have anything to do with the RecordTypes either (when you insert a record via API, you can put any String you want as the picklist value).
So let's start with the checklist and if this doesn't help we'll think about more options :)
EDIT: for all the users who have problems with Salesforce integration (especially "I've created a new custom field, it seems I can query for it but I don't see it in the returned results") there are couple more steps:
If you're using enterprise WSDL - remember to download fresh copy. Java, C# etc. people need to regenerate their classes from the wsdl ("consume" it again) in order to see new fields. PHP users shouldn't worry (last time I've checked everything is done in runtime in "PHP toolkit"... of course if you've actually generated something out of the WSDL - do it again). But in case of PHP it seems WSDL can be somehow cached in your app. Restart the server to make sure fresh wsdl is used?
Took me longer than expected (Apache Axis 2 generates totally different code to the one I'm used too with Axis 1.x) + I've encountered some other distractions, but I've checked it.
In short: it's a normal field available through API and works for me.
Please make sure that your enterprise WSDL contains lines similar to
<complexType name="Task">
<complexContent>
<extension base="ens:sObject">
<sequence>
<element name="Account" nillable="true" minOccurs="0" type="ens:Account"/>
(...)
<element name="Type" nillable="true" minOccurs="0" type="xsd:string"/>
(...)
</sequence>
</extension>
</complexContent>
</complexType>
If it does - regenerate your Java classes from it. If it doesn't - download a new WSDL.
With Apache Axis2 and enterprise.wsdl I was able to create such sample code:
Task task = Task.Factory.newInstance();
task.setType("Alan's Email"); // Not a valid picklist value, just to prove that these don't matter when we use API.
task.setWhatId("0067000000AH3ME"); // An Opportunity Id ("Burlington Textiles" in my test org) to which this task will be related.
task.setStatus("Not Started");
task.setPriority("Normal");
task.setDescription("A new Task has been created with methods from Enterprise WSDL.");
You can download the whole test project (rather big) here. There's high chance the code looks weird if you're used to Axis 1.x style (most of the Salesforce API examples are written using old Axis), but I assure you it worked for me.
If you still need help - I guess we'll have to contact directly?
Good luck.