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
BriscoBrisco 

How to add Task to Lead record in Axis

Using Axis, I've been able to insert Leads into SalesForce.  I'd like to be able to add Activity History items at the same time.  I've tried doing a describe on the "task" entity, but get the following error:

faultString: org.xml.sax.SAXParseException: The content beginning "<0" is not legal markup. Perhaps the "0" (&#30 character should be a letter.

Without this describe, I don't know what fields I need to set in creating the task item.

This is assuming that an Activity History item is the same as a Task item.

Thanks for any help,

Mike

DevAngelDevAngel

Hi Brisco,

Sounds like there is a custom field on you task entity.  The problem with the numerice characters at the start of an id was identified months ago and a backwards patch was created and applied.  This means that you should all field names for custom fields should begin with "cf_" as the fix was to prepend the custom field names this way.  Please try the describe again using version 2.0.  I am assuming that there may be some pre 2.0 version that may not be behaving properly.

If this does not provide the solution for the describe problem, here are the standard fields for the task entity.

accountID, closed, createdDate, createdByID, description, dueDateOnly, id, lastModifiedDate, lastModifiedByID, ownerID, priority (req), status (req), subject, whoID (Contact or Lead ID), whatID (Opportunity or Account ID).

The status field is a picklist that is specific to your salesforce.com implementation.

You should also be able to find the standard fields in the current documentation.

Message Edited by DevAngel on 09-10-2003 09:49 AM

BriscoBrisco

accountID is the one giving me trouble.  I keep getting the error: "bad field names on insert/update call: accountID"

First I create the lead, then get the ID from it and create the task.

Lead creation works.  Task fails. 

        value = (org.w3c.dom.Element)binding.insert("lead", record);
        leadID = XPathAPI.selectSingleNode(value, "/valueMap/id/text()").getNodeValue().toString();

        //add history activity
        salesforce.MapEntry[] task = new salesforce.MapEntry[3]; 
        task[0] = new salesforce.MapEntry();
        task[0].setKey("accountID");       
        task[0].setValue(leadID);
        task[1] = new salesforce.MapEntry();
        task[1].setKey("status");       
        task[1].setValue("New");
        task[2] = new salesforce.MapEntry();
        task[2].setKey("priority");       
        task[2].setValue("High");             

        value = (org.w3c.dom.Element)binding.insert("task", task);

I hope I'm not spelling something wrong!

DevAngelDevAngel

Hi Brisco,

An accountID cannot be a leadID.  If you want the to create a task and assign it to a lead, you will want to replace the line:

task[0].setKey("accountID");

with:

task[0].setKey("whoID");