+ Start a Discussion

Strange Error when Trying to Create Task

We have created an external .NET app that logs into our SalesForce.com account and retrieves corresponding contact data, which is then used to email out company-specific messages. The app works fine, but now we would like to update our SalesForce.com account with a record of those email postings.
Accordingly, it seems like we need to create "completed" tasks that are assigned to each contact that has been emailed. I've written the following test code in .NET just to see if I can create task objects in SalesForce:

Dim sForceService As New sforce.SforceService
sForceService.Url = mSessionURL
sForceService.SessionHeaderValue =
New sforce.SessionHeader
sForceService.SessionHeaderValue.sessionId = mSessionID
Dim taskArray(0) As sforce.sObject
Dim sTask As sforce.Task = New sforce.Task
sTask.CreatedById = mUserID
sTask.OwnerId = mRecipientID
sTask.ActivityDate = DateTime.Now
sTask.Description =
"Test Description"
sTask.Priority = "Normal"
sTask.Status = "Completed"
sTask.Subject = "Email: Test Email"
taskArray(0) = sTask
Dim sr() As sforce.SaveResult = sForceService.create(taskArray)

When I try to run the code in Visual Studio's Debug mode, everything seems to work fine until it gets to the very last line above; when the Dim sr() As sforce.SaveResult = sForceService.create(taskArray) code executes, I get the following error: "Unable to automatically step into the server. Connecting to the server machine "na2-api.salesforce.com" failed. The format of the specified network name is invalid."

I've tried researching this error and verifying that what I'm trying to do is valid, but I can't find any answers. Has anyone tried creating their own task objects before? Note that I'm presuming that the same SalesForce server is used to create new objects as well as read existing company data. All help is appreciated.

I have created task and attached to different objects via API call and the only parameter that i think is missing is whoId, which refer to the object to which the task needs to be attached. Moreover, just verify that the serverurl that you are passing to sForceService object is valid.
Hope that help you out


Thanks for your input. I did get this to work (and yes, I was missing WhoID along with a few other parameters). But the error keeps appearing--I've learned to just ignore it when debugging my app.