Adding Leads VIA Webservice API

This question is not answered

I have a Cloud instance of Sage.  Have allowed Webservice API access. 

I'm attempting to add a Lead via The Webservice API.  I've added the Service Reference in VS and can access the various methods of the Webservice, however, when I create a Lead, it doesn't show up in the Leads list.  The Leads show a count of how many Leads have been created but only those I created in the CRM show up in the list.  

I ran a service.queryrecord(header, "*", "", "lead", "leadid"); to get the list of all Leads and all of the ones I created programatically are returned.  I compared the fields of the one I manually created with the ones I created via the Webservice and made sure the field data matched.  I assume that the assigneduserid field and the opened field need to be set.  When I programmatically set these then call the add() method of the service those property values I set don't get inserted into their fields.

ewarebase[] CRMBase = new ewarebase[1];
var newLead = new lead();
newLead.personfirstname = "John";
newLead.personlastname = "Doe";
newLead.companyname = "Company Name";
newLead.personemail = "email@gmail.com";
newLead.status = "In Progress";
newLead.description = "A Lead from The website.";
newLead.updatedby = 30;
newLead.createdby = 30;

newLead.assigneduserid = 30;
newLead.stage = "New Lead";
newLead.source = "Web";
newLead.priority = "Normal";
newLead.opened = DateTime.Now;
newLead.channelid = 7;
newLead.decisiontimeframe = "unknown";
newLead.companymatch = "Y";

CRMBase[0] = newLead;
addresult aResult = service.add(header, "lead", CRMBase);

service.logoff(header, sessionID);

30 is the id of the user I want the Lead assigned to.  and the DateTime.Now doesn't get submitted either.

opened and assigneduserid are always empty when I query the new Lead.

Anyone know how to add a Lead via the Webservice and have it display in the Leads?

All Replies