Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 866759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:51:45+00:00 2026-05-15T09:51:45+00:00

I am successfully creating a Task using the SalesForce API SOAP API through Java.

  • 0

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 “Call” but I really want them to be “Email”.

Can someone point me in the direction of where I can do this? I think it is to do with RecordTypeMapping, but i am somewhat confused as to how to use this in my Java code to look up the particular one for Task type.

I feel I have got so close with this. I have the correct WSDL that is giving me the extra method on the Task.java class, but no matter what I pass in, it dies.

This doesn’t seem to be a huge ask, yet i am perplexed as to which dots to join to get it to work

Any help would be appreciated. thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:51:46+00:00Added an answer on May 15, 2026 at 9:51 am

    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 🙂

    1. Is the field visible on the “New Task” page?
    2. What does the “View field accessibility” button say? (put your own org ID in the link, I’ve used my “na5”)
    3. Do you know the Profile of the user whose credentials you use to connect via API (for example “System Administrator”)? Can you verify in the “Set Field-Level security” that this Profile can see this field (1st checkbox) and it’s not marked as readonly (2nd checkbox)?
    4. Can you try to set up the “Call” as default value for this field and see what happens?
    5. Can you try to insert a new Task through the Salesforce.com Data Loader? If it will work, it will mean that API on it’s own is OK (Data Loader also uses the API) and the problem lies somewhere in your app.
    6. If you really need to access the so-called metadata to know what are the possible values of a picklist, you can use the describe() calls. This should get you started but as I said before – as far as I remember the picklist values aren’t really enforced when you use API.
    7. Stupid, but… consult your System Administrator if he didn’t put any workflows that modify the value of this field. And ask the Apex developers if there are any “before insert” triggers on the Task object…

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully set up a quick test of creating a REST-like service that
I'm creating a process on Windows from Java. My problem is that this process
I am successfully creating a marker on click however, using the following code, I
I have successfully automated the process of creating a new IIS website, however the
I'm creating an XML file using Perl and XML::Simple module. I successfully create the
PayPal successfully returns me the return URL that I specify while creating "buy now"
My java application uses log4j for logging. Using ant the project builds successfully, but
I am successfully creating database (SQL Ce) using Entity Framework Code First approach (C#-WPF).
Am attempting to teach myself to program using Tcl. The task i've set myself
After successfully creating some applets, I embedded them in a webpage and discovered that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.