I am trying to create a new Customer Interaction record via form script. When I execute the following script, I get a successful message, but the interaction record does not get created. Has anyone done this and have some advice on what I am missing or doing incorrectly? Here is my current script:
Sub CreateInteraction()
Try
Dim request As New UpdateCollectionRequestData()
Dim response As UpdateCollectionResponseData
Dim newInteraction As New IDOUpdateItem()
request.IDOName = "SLInteractions"
request.RefreshAfterUpdate = True
newInteraction.Action = UpdateAction.Insert
newInteraction.ItemNumber = 1
' Used for error reporting
Dim custNum = ThisForm.PrimaryIDOCollection.CurrentItem.Properties("CoCustNum").Value
Dim custName = ThisForm.PrimaryIDOCollection.CurrentItem.Properties("Adr0Name").Value
Dim custSeq = ThisForm.PrimaryIDOCollection.CurrentItem.Properties("CoCustSeq").Value
Application.ShowMessage("This: " & custNum & " " & custName & " " & custSeq)
newInteraction.Properties.Add("RefNumID", custNum)
newInteraction.Properties.Add("CustName", custName)
newInteraction.Properties.Add("CustSeq", custSeq)
newInteraction.Properties.Add("Description", "SITE LOCATION FOLLOW UP")
newInteraction.Properties.Add("Topic", "New")
newInteraction.Properties.Add("InteractionType", "C")
newInteraction.Properties.Add("IDNotes", "This Is A Test")
newInteraction.Properties.Add("ParCompany", "MyCompany")
newInteraction.Properties.Add("ParSite", "Default")
newInteraction.Properties.Add("Stat", "A")
request.Items.Add(newInteraction)
response = Me.IDOClient.UpdateCollection(request)
' Check if response is valid
If response IsNot Nothing Then
Application.ShowMessage("Interaction created successfully.")
Else
Application.ShowMessage("Response is Nothing. Interaction creation failed.")
End If
Catch ex As Exception
Application.ShowMessage("Error: " & ex.Message)
End Try
End Sub