C Contact Management Incidents

From Sage Evolution SDK | Documentation Portal
Jump to: navigation, search

Incidents can be created and actions can be posted for existing Incidents as per example below.

{
    //Create a instance of the Incident class
    Incident inc = new Incident();//specify a existing incident number here if using a existing incident
    inc.Customer = new Customer("CASH");
    inc.Outline = "Test Incident";
    inc.IncidentType = new IncidentType("Undefined");
    inc.Priority = new Priority("High");
    inc.DueBy = DateTime.Now.AddHours(24);
    //inc.Contract=new Contract (1);  //Contract templates have only one overload that is the contract id         
    inc.Category = new IncidentCategory ("category1");
 
    IncidentLogEntry action = inc.NewAction();
    action.Agent = new Agent("Admin");
    action.NewAgent = new Agent("Admin");
    action.Resolution = "Content";
    //Log and post the incident action
    inc.Post(action);
    //Linking of documents to a incident can be done as follows if required
    //Remeber to specify document storage path in Contact management defaults
    string DocDescr = "TestDoc";
    if (Document.FindByDescription(DocDescr)==-1)
    {
    Document doc = new Document();
    doc.Name = "TestDoc";
    doc.Description = DocDescr;
    doc.Save(@"C:\Evofiles\test.txt");
    }
    Document docexist = new Document(DocDescr);
    docexist._CreateLink(inc);             
}