You can do all sorts of crazy things using TopLine Designer scripting. For example, you can create a new history record. Doing this is extremely easy.
Use the code below to create a history record when the user clicks on the OK button.
'This code runs immediately after the OK or Cancel button is pressed.
'e.Cancel - Change the Cancel variable to True and the OK or Cancel buttons will not close the window. ex: e.Cancel = True
Public Sub OnBeforeClose(e as ScriptOnBeforeCloseEventArgs) Implements IScript.OnBeforeClose
'Place Code Below
'If the user clicked on the OK button, then...
If e.CloseReason = "OK" Then
'Create a new Call history.
CreateHistory("Call Complete", Now, "Finished Call", "Put some details in here")
End If
End Sub
Below is the actual code used to create the history.
'Create a new history record.
Public Sub CreateHistory(ByVal sHistoryType As String, ByVal HistoryDate As Date, ByVal Regarding As String, ByVal Details As String)
Dim h As Act.Framework.Histories.History
If GetParentContacts.Count > 0 Then
Dim Contact As Act.Framework.Contacts.Contact = GetParentContacts(0)
Dim HistoryType As Act.Framework.Histories.HistoryType = Nothing
HistoryType = Globals.ACTApp.Histories.GetHistoryType(sHistoryType)
If HistoryType IsNot Nothing Then
h = Globals.ACTApp.Histories.CreateHistory(Contact, Nothing, HistoryType, False, HistoryDate, HistoryDate, Regarding, Details)
End If
End If
End Sub
Leave a comment!
You must be logged in to post a comment.