Add Case Example using Web Service Interface

1 minute read time.

Below is some simple C# code that shows how to add a new Case to an existing company. The case is inserted and linked to 'Gatecom' and 'Simon Yaltoy' and assigned to 'Kylie Ward'.

The code logons on, inserts the case and then logs off.

WebService CRMsp1 = new WebService();
logonresult CRMLogon = CRMsp1.logon("Admin", "");
CRMsp1.SessionHeaderValue =
new SessionHeader();
CRMsp1.SessionHeaderValue.sessionId = CRMLogon.sessionid;
ewarebase[] CRMBase = new ewarebase[1];
cases CRMCase = new cases();
crmid newRecordID = new crmid();

CRMCase.primarycompanyid = 28;
CRMCase.primarycompanyidSpecified =
true;

CRMCase.primarypersonid = 30;
CRMCase.primarypersonidSpecified =
true;

CRMCase.description = "Example Case Description";
CRMCase.problemnote =
"This is the detailed note that describes the issue.";
CRMCase.stage =
"Logged";
CRMCase.status =
"In Progress";

CRMCase.assigneduserid = 5;
CRMCase.assigneduseridSpecified =
true;

CRMBase[0] = CRMCase;

addresult CRMAddResult = CRMsp1.add("cases", CRMBase);

CRMsp1.logoff(CRMsp1.SessionHeaderValue.sessionId);

Notes

  • Gatecom has company id of 28
  • Simon Yaltoy has person id of 30
  • Kylie Ward has user id of 5