Case Deflection Implementation & Customization
Since every CRM can be customized and the requirements for creating a closed case can be different, you can implement a class to specify how the "Case" should be created and what fields should be populated.
This implementation is most appropriate for Case Deflection workflows such as "Display KB before ticket creation and create a closed ticket, if a solution is found".
The interface implemented provides the context of which article the user viewed and indicated that it resolves their issue, the original case subject/search term and also possibly a Case ID value.
The "CaseId" value would only be provided if the "Create Case first" workflow is selected.
Below is a sample of Case Deflection implementation for Salesforce CRM:
publicclass <CompanyName>Prevention : AspxClass, ICaseDeflection
{
public ActionResponse CaseDeflected(string articleId, string subject, string caseId)
{
if (string.IsNullOrEmpty(caseId))
{
// Workflow: 3
var newTicket = new Force__Case {
AccountId = SystemInfo.UserInfo.AccountId,
ContactId = SystemInfo.UserInfo.ContactId,
Subject = subject,
Status = "Closed by KB"
};
Database.Create(newTicket, new DatabaseOptions { SystemMode = true });
caseId = newTicket.Id;
// articleId can be a WikiPage ID or BlogPost ID
ArticleSearchHelper.CreateCaseArticle(articleId, caseId);
}
else
{
//workflow: 1, when case ID exists the product code creates the CaseArticle itself.
var ticket = Database.Query<Force__Case>()
.Where(a => a.Id == caseId)
.FirstAsAdmin();
ticket.Status = "Closed by KB";
Database.Edit(ticket, new DatabaseOptions { SystemMode = true });
}
returnnew RedirectResponse("/force/force__case");
}
}If an active page is used as the New Case form, its active controller requires the following code for its POST action.
if (!IsEmpty(Request["articleSearchId"]))
Opirus.Web.Helpers.ArticlesHelper.TrackTicketCreate(Request["articleSearchId"]);