contacts.addContact
Description
Creates a new contact including address.

Parameters
address_Title string
address_FirstName string
address_Surname string
address_CompanyName string
address_Address string
address_PostCode string
contact_Phone string
contact_Mobile string
contact_Email string
contact_Notes string
contact_ContactTypeId integer

Return value
contactID integer (-1 if failed)

Example
local newContactID = contacts.addContact("Mr", "Jack", "O'Neill", "", "1 The Road\nSometown\nCounty", "ST1 1ST", "01234567", "07123456", "email@domain.com", "Notes line 1\nNotes line 2\n\nTHIS IS A TEST CONTACT", 1)
if newContactID == -1 then
    print("Error adding contact")
else
    print("Added contact ID " .. newContactID)
end

Comments
Use \n to add newline characters in address or notes parameters.

Contact types IDs are listed in the ContactTypes table. Use the following code to view all contact type IDs in the output window.

local grid = data.runSelectQuery("SELECT * FROM [ContactTypes]")
data.printGrid(grid)


See also

Back
Generated on the 26 June 2024 at 22:01:27 (UK Time)