Create an Example Custom AgileConnector
This topic gives an example of how to create a custom AgileConnector that does custom exception handling in AgilePoint NX.
Create a New Project for the Example AgileConnector in AgilePoint NX Developer
To create a new project for the example CustomExceptionHandler, do the procedure in this topic.
Screen
Prerequisites
Good to Know
- To download a sample AgileConnector for custom exception handling, refer to AgileConnector Sample for Custom Exception Handling.
Procedure
- In Microsoft Visual Studio, click File > New > Project.
- On the New Project screen, click AgileConnector.
- In the Name field, enter CustomExceptionHandler.
- In the Location field, click the Browse, and select the location to create the project.
- Click OK.
- On the AgileConnector Wizard screen, in the AgileConnector Type field, select Event Listener AgileConnector.
- Click Next.
- To add sample custom dialog to the project, select Add Sample Custom Dialog.
- In the Custom Dialog Type field, select Windows Form (WinForm).
- Click Finish.
Configure the Runtime Functionality for an Example AgileConnector
This topic gives an example of how to configure the runtime functionality for an example CustomExceptionHandler AgileConnector with the AgileConnector project template.
Good to Know
- The AgileConnectorDaemon.cs file has different code for Event Listener Type and Polling Service Type of AgileConnector.
- Signing an assembly for strong name is done when the AgileConnector project template generates code.
- To download a sample AgileConnector for custom exception handling, refer to AgileConnector Sample for Custom Exception Handling.
Procedure
- In the AgileConnectorDaemon.cs file, replace the default class name MyAgileConnectorDaemon with CustomExceptionHandler.
[IntegratedApplicationDescriptor(typeof(MyAgileConnectorDescriptor))] public class MyAgileConnectorDaemon : WFIntegratedApplication, IWFTrackingEventPublisher
- Replace this C# code in Publish
method to handle the custom exceptions:
public void Publish(IWFTrackingEvent evt) { try { IWFFaultingExceptionTrackingEvent fault = evt as IWFFaultingExceptionTrackingEvent; if (fault == null) return; // in case it is not IWFFaultingExceptionTrackingEvent DateTime dateOccured = fault.DateOccured; Exception e = fault.FaultingException; // release this object reference immediately when it is done. IWFProcessInstance pi = fault.ProcessInstance; } catch (Exception ex) { Logger.WriteLine("{0}: Error when processing event {1}. Error Message: {2}", base.AppName, evt.EventName, ex.Message); } }
Create a .dll File for the Example AgileConnector
To create a .dll file for the example CustomExceptionHandler AgileConnector to deploy in AgilePoint NX, do the procedure in this topic.
Good to Know
- The deployment package is created with the name [project folder]\bin\ CustomExceptionHandler.dll.
Procedure
- In Microsoft Visual Studio, on the Solution Explorer pane, right-click the project name CustomExceptionHandler.
- Click Build.
Deploy the Example AgileConnector Package in AgilePoint NX
To deploy a AgileConnector package for the example CustomExceptionHandler connector in AgilePoint NX, do the procedure in this topic.
Screen
Good to Know
- The custom Exception Handler AgileConnector is shown on the AgilePoint Server Extensions screen.
- The configuration information is stored in the file netflow.cfg.
How to Start
- On the AgilePoint Server machine, in Windows Explorer, right-click the file (AgilePoint Server installation folder) C:\Program Files\AgilePoint\AgilePoint Server\WCFConfigurationUtility.exe, and click Run as Administrator.
- On the AgilePoint Server Manager screen, in the left pane, select your AgilePoint Server instance.
- Click Open Server Configuration .
- On the AgilePoint Server Configuration screen, click the Integrations tab.
- Click Add.
Procedure
- On the Global Extended Module screen, in the Name field, enter the name of your assembly — for example, CustomExceptionHandler.
- In the Assembly field, click the Ellipses button.
- Select your custom assembly — for example, CustomExceptionHandler.dll.
- Click Open.
The Class Name field completes.
- Click OK.
- (Optional) To set additional configuration properties for this AgileConnector, do this procedure.
- Click Configure.
- On the Custom Form screen, configure the rules.
- Click OK.
Implement the Example AgileConnector in AgilePoint NX Portal
To implement the custom Exception Handler AgileConnector, do the procedure in this topic.
Prerequisites
- You must deploy a custom Exception Handler AgileConnector.
For more information, refer to Deploy the Custom Exception Handler AgileConnector.
Good to Know
- To use the Global Exception Handling option, you do not need to do anything extra in the system activity code, the implementation is specified in the Process Builder.
How to Start
- Open Process Builder.
For information about how to open this screen, refer to Process Builder.
- In Process Builder, in the Activity Library, drag any system activity onto your process.
- Select a system activity.
- Click Properties > Activity Properties.
Procedure
- On the Properties - System Activity screen, do one of these.
- To save the exception handling information for a system activity in the SaveErrorMessageTo and SaveStatusTo properties,
do this procedure.
- In the ExceptionHandlerScope property field, select Local.
- To save the exception handling information for a system activity in the SaveErrorMessageTo and SaveStatusTo properties and
include the extended ability to call a custom AgileConnector to handle the exceptions, do this procedure.
- In the ExceptionHandlerScope property field, select Global.
- To save the exception handling information for a system activity in the SaveErrorMessageTo and SaveStatusTo properties,
do this procedure.