Below is some example C# code that shows how to use the add() method to add a new Lead record into the Sage CRM database.

The code will set the value for the Opened Date field and the Assigned User value.


The following assumptions have been made.

1) The system is configured within the Web Service Administration screens to work with UTC time.

Administration -> System -> Web Services

Send and return all dates and times in universal time: Yes

2) The Web Service object has been instantiated as an object called 'CRMService'

[Code language='csharp']
ewarebase[] CRMBase = new ewarebase[1];

lead newLead = new lead();
crmid newRecordID = new crmid();

newLead.companyname = "test" + labelSessionID.Text;
newLead.channelid = 1;
newLead.channelidSpecified = true;
newLead.stage = "Assigned";
newLead.status = "In Progress";
newLead.source = "Web";
newLead.companyaddress1 = "1 Main Road";
newLead.description = "Simple SOAP";
newLead.details = "Blah, Blah, Blah";
newLead.personfirstname = "Jeff";
newLead.personlastname = "Richards";
newLead.assigneduserid = 4;
newLead.assigneduseridSpecified = true;
newLead.opened = DateTime.Now.ToUniversalTime();
newLead.openedSpecified = true;

CRMBase[0] = newLead;
addresult CRMAddResult = CRMService.add("lead", CRMBase);