Community
Showing results for 
Search instead for 
Do you mean 
Reply

Plugin to copy data into other fields

Avid Listener
Posts: 2
Country: Australia

Plugin to copy data into other fields

Hi all,

 

I am trying to create a (hopefully) simple plugin that will copy data from certain fields and insert it into other fields in the same contact. I'm sure its an easy process, but I am not familiar with syntax. I do have some programming experience, however I am brand new to ACT.

 

Can anyone help me? Please let me know if I need to provide more details.

 

Matt

Nickel Super Contributor
Posts: 441
Country: UK

Re: Plugin to copy data into other fields

Private Sub CopyFields(ByVal field1 As String, ByVal field2 As String, ByVal cList As Act.Framework.Contacts.ContactList) 'copies the field Dim source As String = FindFieldTrueName(field1) Dim destination As String = FindFieldTrueName(field2) If source <> "" And destination <> "" Then For Each contact As Act.Framework.Contacts.Contact In cList Try contact.Fields(destination, True) = contact.Fields(source, True) contact.Update() Catch ex As Exception System.Windows.Forms.MessageBox.Show(ex.Message, "ACT!", Windows.Forms.MessageBoxButtons.OK, Windows.Forms.MessageBoxIcon.Error) End Try Next End If ActApp.RefreshLoadedViews() prg.Close() End Sub Private Function FindFieldTrueName(ByVal dispName As String) As String For Each field As Act.Framework.Contacts.ContactFieldDescriptor In ActApp.ActFramework.Contacts.GetContactFieldDescriptors If field.DisplayName = dispName Then Return field.Name End If Next End Function

 The code above copies 1 field to another....you just need to pass the display names of the source field and destination field and the list of contacts to process.  Hope that helps.

 

Tom