Download PDF
Download page Creating External Actions.
Creating External Actions
Over and above the standard actions, Designers can include their own actions through the External Library capabilities. This requires the use of the X-Author SDK libraries to create custom DLLs. For example, you could create an external action for something as simple as record data cleansing, or something more complex such as invoking Oracle or SAP web services.
The X-Author SDK is made available only on a request basis. Please contact the dev team for more information.
Prerequisites for creating Actions
- An Integrated Development Environment that enables you to build DLLs. In the example in this procedure, Microsoft Visual Studio is used to describe the setup process for External Actions.
How to design an External Action
Create a Visual Studio Class Library Project. The X-Author client installer includes a sample C# file.
The code sample shows the functions to use and it will pop up a message box in runtime. You can extend the Execute() function to write your custom logic using the full power of Visual Studio and .NET.
- Add a reference of the Apttus.XAuthor.ExtensionLib module into the project. The Apttus.XAuthor.ExtensionLib action class which represents an action is available for external use in this SDK Library. Any user who designs a new action, needs to add a reference of this library in their Visual Studio project. This library extends the following:
- Action Class extends the capabilities of the Base class capabilities to the custom .cs file.
- IActionRuntime interface invokes the execute method defined in a custom .cs file.
- Provide Name and Type for the external action and provide custom logic for the Execute() function.
Compile and link the assembly to generate the output .NET assembly. The .NET assembly should be a .dll file.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Apttus.XAuthor.Core; using System.Xml.Serialization; using System.Runtime.InteropServices; namespace TestExternalAction //Apttus.XAuthor.Core.Action is the base class of the module for which the capabilities are extended. Using the IActionRuntime interface invokes the custom execute method. { public class FirstExternalAction : Apttus.XAuthor.Core.Action, IActionRuntime { //Custom class. You can define any object that you choose in your class. public FirstExternalAction() { Name = "First External Action"; Type = "External Message Action"; } //Defining the logic on execution of the external action. public ActionResponse Execute(ActionRequest request) { ActionResponse r = new ActionResponse(); System.Windows.Forms.MessageBox.Show("External Action : Executed"); r.Status = ActionResultStatus.Success; return r; } } }
CODE
The sample *.cs file can contain one or more external actions.
How to link an External Library into X-Author
After developing an External Action that is part of a library (.NET assembly), load the library into X-Author Designer using the following steps.
- Navigate to the X-Author for Designer Tab.
- Click External Library, load the required .dll file and click OK.
After you load the selected assembly, X-Author detects all the external actions within that assembly. - Invoke the newly created external actions within an Action Flow just like built-in actions.
To update an existing external library
To update and link a new version of the library into X-Author, ensure that any external actions within that library are not in use in any Action Flow. You can update an existing external library only under certain conditions.
How to remove an existing external library
A user can remove an already linked external library. To remove an existing library, open the existing library and select a row and click Unlink Library. An External Library can only be removed if any of the External Actions exported in the library is not used in an Action Flow.