Connecting to the Campaign Manager server

The first method that must be called from a custom API program is DVBCMClient.Connect. The client must be connected to a Campaign Manager server before any other calls will work.

The Connect function has two parameters. The first is a Campaign Manager server node name. There are two things that must occur for this parameter to work.

  • The Campaign Manager service must be running on the configured Campaign Manager server machine prior to connecting or the connect method call will fail.

  • This server node name must be a valid computer name, that is, a computer on the same network as the client.

If either of these two requirements is not met, the method will fail. For information on how to start the Campaign Manager server refer to the DeltaV Batch Application Manager online help.

The second parameter is an optional Boolean flag that is defaulted to TRUE. The bStartEvents flag is used to determine if the program wants to receive update events. A custom program usually wants to receive updates unless it is a web-based application. In a web-based application, the events will not fire correctly anyway. Update events allow the program to receive notifications from the Campaign Manager server, for example, when a campaign or batch's state changes or when a campaign or batch has been added or deleted.

The following is an example sub written in Visual Basic that shows how to correctly connect to the Campaign Manager server.

Private Sub ConnectToServer()
    Dim strNodeName As String
    ' Prompt the user for a computer name
    Call PromptUserForCMNode(strNodeName)
    ' Connect API to the Campaign Manager server
DVBCMClient.Connect(strNodeName)
End Sub
Note:

Before exiting the program, DVBCMClient.Disconnect should always be called to sever ties between the program and the Campaign Manager server.

Private Sub MainForm_Unload()
    Call DVBCMClient.Disconnect
End Sub