To create custom code within the Custom Code Editor follow these steps


  • Select the language you wish to use with the language drop down of either VB.NET or C#.NET.




  • Modify the name of the plug-in that will be displayed in the audit log - for example "Update Database".


/// <summary>

/// Implements the name of this custom plugin

/// </summary>

public override string Name

{

get { return "Update Database"; }

}



  • Modify the execute method and add any custom code you wish, the comments in the summary block can be replaced as required.


/// <summary>

/// The summary can be updated to provide useful information.

/// </summary>

public override void Execute()

{


}



  • Variables can be accessed and modified through the Variables property. To modify a variable named ExpiryDate use the following code.

    Variables.FindByName("ExpiryDate").Value = DateTime.Now.AddMonths(1);



  • Information can be written to the XIA Automation Server trace log using the OnAgentStatusChange() method.

    OnAgentStatusChange ("The custom plugin in now starting...");


  • Information can be written to the XIA Automation Server audit log using the OnAuditAction() method passing the message to write to the audit log and the AuditEntryType.

    OnAuditAction("The agent has modified the ExpiryDate", AuditEntryType.Information);


  • The optional available for the AuditEntryType are displayed by Intellisense 


  • Standard .NET exception handling applies to custom code.

    Variable UsernameVariable = Variables.FindByName("Username");
    if (UsernameVariable==null) throw new ArgumentException("The Username variable was not found.");