The Global Script Editor (GSE) in DTM provides an extension mechanism. It allows you to interface with DTM and take actions when events occur. Some examples of what has been done using the GSE:
- Email notification to a manager when a new user is created.
- Email notification when an attribute is changed.
- Assigning a value to one attribute based on the value of another
You can also use a DTM PowerTool to extend DTM. A PowerTool can be used in two possible ways: 1) As a tool that is called from the script in the GSE, or 2) as compiled code that overrides the events fired in the GSE (or both).
Here is a real life sample script from the GSE that uses a PowerTool:
| |
sub DTM_RowChanging(dtmsource As Object, args As JobEventArgs) handles DTM.RowChanging ' User-definable script goes here ----------------- ActiveDirectoryTool.ConfigureFromDestination() If ActiveDirectoryTool.IsAttributeChanging("extensionAttribute5") Then Dim sSubject, sBody, sTo as String sSubject = "User changed locations - " & args.StagingDestination("CN") & " (" & args.StagingDestination("SamAccountName") & ")" sBody = NotificationTool.CreateBodyFromTemplate(args.StagingDestination, "D:\Program Files\Imanami\DTM3\GrantThornton\newuser.html.template") sTo = GTExcelConfig.SimpleLookup("Email Notify", String.Format("Location='{0}'",DTM.Source("LOCATION").Trim),"Email Addresses","Postmaster@gt.com") NotificationTool.SimpleSendHtmlNotification(sTo, sSubject, sBody) End If ' ------------------------------------------------- end sub |
There are 14 events your script can be notified of and take action on. Here they are listed:
- Startup - Job starts
- BuildSourceQuery - Fired when the source command is composed. Your script can override the DTM command.
- RowStarting - When a row is being processed
- BuildDestinationQuery - Fired when the destination query is built.
- RowChanging - Fired before a row change is committed in the destination.
- RowChanged - Fired after a row change has been successfully committed to the destination.
- RowAdding - Fired before a row addition is committed in the destination.
- RowAdded - Fired after a row has been successfully added to the destination. Useful for logging or copying the transaction to another system.
- RowDeleting - Fired before a row deletion is committed in the destination.
- RowDeleted - Fired after a row deletion has been successfully committed to the destination. Useful for logging or copying the transaction to another system.
- RowFinishing - Fired before a row change is finished.
- RowFinished - Fired when a row is completed. Useful for logging or copying transaction to another system.
- RowFailed - Fired when an error occurs processing a row.
- Shutdown - Job ending