Escalation
There may be occasions where Actions need to occur if an in-progress Infiniti workflow has been left idle for too long. For example, if a particular form hasn’t been completed within a week, then an email might be sent to the person who initiated the process. These “actions that occur at a later time” are referred to as Escalations.
Infiniti includes the following Escalations out of the box:
- Send Email: notification to a relevant party.
- Reassignment: reassigns the current task to the appropriate user.
- Push Notifications (for the Infiniti apps).
In the case that a different system needs to be notified or a more customised approach used, then an Escalation Extension can be built to handle the situation.
Scheduler
- The Infiniti Scheduler must be configured and running in order to use Escalations.
- If Custom Actions required, they have to be included in Scheduler
appsettings.json
.
Escalation Features and Characteristics
Escalations are summarised in the points below:
- Escalations are defined on the workflow page in Design. Add them to the workflow state for which an Escalation should occur after a given amount of time.
- An Escalation can first execute a certain time after the workflow reaches the particular state, or it may run on a specified date.
- Multiple Escalations of the same type may be added to a workflow state. For example, an email may be sent to the person who needs to do the work, and also another email to their manager.
- Escalations can be conditioned so that they are only run when appropriate, for example, send an email earlier if the details on the form deem it more urgent.
- Escalations can source attribute and settings dynamically from the question set, for example, retrieve an email address from a data source.
- Once an Escalation has executed for the first time, it may be configured to perform over and over again for a defined period. For example, send an email every day for two weeks.
Escalation Extension Development Walkthrough
The walkthroughs below have been created using Microsoft’s Visual Studio 2017. All sample code is based version 7.0 of the C# language and version 4.6 of the .NET Framework.
This walkthrough will show how to create a “SimpleEscalation” Escalation Extension – in this case, it will write a line in a text file on the server whenever the Escalation triggers.
- Open Visual Studio and create a new Class Library Project and give it a meaningful name. For this example, we will use
SampleEscalationExtension
. Ensure that the .NET Framework 4.6.2 is selected.
- Rename
Class1
to something more meaningful such asSimpleEscalation
.
- Click ‘Yes’ to the rename all references prompt.
- Add the following references to the project.
Intelledox.Extension.dll
Intelledox.Extension.Escalation.dll
Intelledox.QAWizard.dll
Intelledox.QAWizard.Design.dll
Intelledox.Model.dll
Best Practice
- Reference Paths point to correct Infiniti deployment path, usually located
C:\inetpub\wwwroot\Infiniti\Produce\bin
.- Copy Local property should be set to
False
for all Infiniti References, as this could corrupt your instance if an older reference is copied to an upgraded site.
- Inherit from
Intelledox.Extension.Escalation.EscalationExtension
and override necessary EscalationExtension methods, as per the sample below.
using System;
using System.Threading.Tasks;
using Intelledox.Extension.Escalation;
using Intelledox.QAWizard;
namespace SampleEscalationExtension
{
public class SimpleEscalation : EscalationExtension
{
public override ExtensionIdentity ExtensionIdentity
{
get => throw new NotImplementedException(); protected set => throw new NotImplementedException();
}
public override Task RunAsync(EscalationProperties properties)
{
throw new NotImplementedException();
}
public override bool SupportsRecurring()
{
throw new NotImplementedException();
}
}
}
Build Successfully
The project should build at this point without error.
- Implement the ExtensionIdentity property so that it initializes the ExtensionIdentity object containing an
Id
and aName
to register the Escalation within Infiniti. TheId
needs to be unique and theName
is displayed to the user in Design.
public override ExtensionIdentity ExtensionIdentity { get; protected set; }
= new ExtensionIdentity()
{
Id = new Guid("3A9E90C7-2826-4C29-8641-6DE92D5D0F8D"),
Name = "Infiniti Simple Escalation Extension"
};
- The
SupportsRecurring()
method defines whether or not this Escalation can run multiple times for a particular project. For this particular example, there is no reason why this can't run repeatedly.
public override bool SupportsRecurring()
{
return true;
}
Note
The Reassignment Escalation is an example of an Escalation which doesn’t support recurring – once the project has been assigned to somebody else, it can’t be reassigned to them again.
- The
RunAsync()
method defines what happens when the Escalation executes.
For this example, the method is going to write “Hello World” and a timestamp to a file on the server.
public override async Task RunAsync(EscalationProperties properties)
{
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\temp\HelloWorld.txt", true))
{
await file.WriteLineAsync(DateTime.Now.ToString());
}
}
- Build your Escalation to ensure it compiles without error. The Escalation can now be deployed and tested.
Scheduler
The directory the file is located in may need to change depending on the permissions on your server. The Infiniti Scheduler must have permission to write to the location specified, otherwise, the Escalation will fail.
Deploying an Escalation Extension
Escalation Extensions are deployed to an Infiniti environment by copying the Escalation Extension dll file to the Scheduler bin directory and referencing it within Scheduler appsettings.json
file.
-
Locate your
SampleEscalationExtension.dll
file and copy it to the Scheduler root (usually locatedC:\inetpub\wwwroot\Infiniti\IntelledoxScheduler
). -
Open the produce
appsettings.json
file and locate the “Extensions” section of the file. -
Add a new Escalation Extension element using the following syntax to the
appsettings.json
"ClassName (including namespace), AssemblyName"
Examle:
"Extensions": [
"Intelledox.Extension.ActionBuiltin.PrintAction, Intelledox.Extension.ActionBuiltin",
"Intelledox.Extension.ActionBuiltin.UserAction, Intelledox.Extension.ActionBuiltin",
"Intelledox.Extension.ActionBuiltin.WebhookAction, Intelledox.Extension.ActionBuiltin",
"Intelledox.Extension.ActionBuiltin.RESTAction, Intelledox.Extension.ActionBuiltin",
"Intelledox.Extension.ActionBuiltin.OracleAction, Intelledox.Extension.ActionBuiltin",
"Intelledox.Extension.ActionBuiltin.PushNotificationAction, Intelledox.Extension.ActionBuiltin",
"Intelledox.Extension.EscalationBuiltin.EmailEscalation, Intelledox.Extension.EscalationBuiltin",
"Intelledox.Extension.EscalationBuiltin.ReassignmentEscalation, Intelledox.Extension.EscalationBuiltin",
"Intelledox.Extension.EscalationBuiltin.PushNotificationEscalation, Intelledox.Extension.EscalationBuiltin",
"SampleStateExtensions.SimpleState, SampleStateExtensions"
],
- Save the
appsettings.json
file. - Add this Escalation into a Workflow test project and make sure it creates a file in C:\temp\HelloWorld.txt as expected when escalation rules are met.
More Examples
More examples are available in Intelledox Github account
Final Full Code
using System;
using System.Threading.Tasks;
using Intelledox.Extension.Escalation;
using Intelledox.QAWizard;
namespace SampleEscalationExtension
{
public class SimpleEscalation : EscalationExtension
{
public override ExtensionIdentity ExtensionIdentity { get; protected set; }
= new ExtensionIdentity()
{
Id = new Guid("3A9E90C7-2826-4C29-8641-6DE92D5D0F8D"),
Name = "Infiniti Simple Escalation Extension"
};
// Main entry point in the escalation where it will perform its custom operations
public override async Task RunAsync(EscalationProperties properties)
{
// Implement custom escalation details here. Send notifications, update services, etc
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\temp\HelloWorld.txt", true))
{
await file.WriteLineAsync(DateTime.Now.ToString());
}
}
// Defines whether or not this escalation is allowed run multiple times for a particular project
public override bool SupportsRecurring()
{
return true;
}
}
}
Updated over 6 years ago