Community
Showing results for 
Search instead for 
Do you mean 
Reply

Creating a new Contact through the SDK

Copper Contributor
Posts: 18
Country: New_Zealand

Creating a new Contact through the SDK

Hi Everyone,
 
I'm currently working on a small application for one of our clients, the idea behind it is that it reads contact data from an external CSV file and compares that data to the contact records in an ACT , if a contact is not found then the application is supposed to add it to the database, there is alot more to this but this is just an overview.
 
My question is How do I create a new contact and add it to the Database, below is a sample code that am working on, not sure what I'm
missing here, ACTFM is defined as part of the class containing this function.
 
 
-----------------------------------------------------------------------------------------------------------------------------------------------

Public Function AddContact(ByVal CSVContact As CSVRecord) As Boolean

Dim bSuccess As Boolean
Dim oNewContact As Act.Framework.Contacts.Contact
Dim fldFName As String

fldFName = GetACTFieldName("Contact")
oNewContact = ACTFM.Contacts.CreateContact

Try
 UpdateField(CSVContact.FirstName, oNewContact, fldFName)
 bSuccess = True
Catch ex As Exception

End Try
Return bSuccess

End Function

-----------------------------------------------------------------------------------------------------------------------------------------------

Wondering if there is anything that I need to do after I instantiate a new Contact object (oNewContact = ACTFM.Contacts.CreateContact ?), any ideas

Many thanks in advance.

Firas

Firas Hermez
Lead Developer
Xact Software Solutions ltd
www.twitter.com/xactsoftware
crminformer.blogspot.com
www.freeactaddons.com
Tuned Listener
Posts: 24
Country: USA

Re: Creating a new Contact through the SDK

You need to call ActFramework.Contacts.CreateContact() to return you a new Contact object. Then to persist it to the database call the Update method on the Contact object.
Copper Contributor
Posts: 18
Country: New_Zealand

Re: Creating a new Contact through the SDK

Hi Mark,

Thanks for the response, I was calling the update method of the contact object but I was doing that further down in the code, I added line of code to call that method right after the object was instantiated and that seems to have sorted my problem out.

Thanks again =)

 

 

Firas Hermez
Lead Developer
Xact Software Solutions ltd
www.twitter.com/xactsoftware
crminformer.blogspot.com
www.freeactaddons.com