sgapiAddContactToList(%%listID, %%email, %%fields, %%customfields)

Important Update to Custom Scripting

SurveyGizmo's CustomScript Action now supports the LUA programming language. Visit our NEW Lua Scripting Resources!

Legacy Custom Scripting Language Deprecation Plans 

  1. New accounts (created after October 29, 2018) will only have the option to use Lua in scripts.
  2. As of October 29, 2018 Custom Scripting Actions will default to Lua as the scripting type in the Custom Scripting Action for accounts created before this date. You will be able to switch to the Legacy Custom Scripting; though we highly encourage using Lua.
  3. In the long term, Legacy Custom Scripting Actions will be switched to read-only. The exact date on this is to be determined; we will send notifications well ahead of time.

Our Email Lists allow account administrators to manage contacts for email lists at an account level. This function adds a new contact or updates an existing contact inside of a Contact List (as opposed to an email campaign).

Parameters

  • %%email* - the email of the contact you'd like to add
  • %%listID* - the ListID of your email campaign. You can find the List ID in your URL by going to Account > Email Lists and clicking into the email list. You'll see the variable gid=#.
  • %%fields is an array of the contact fields you'd like to update.
  • %%customfields is an array of the custom invite fields you'd like to update

*Required parameters

%%field or %%customfield parameter Contact List Field
sFirstName First Name
sLastName Last Name
sOrganization Organization
sDivision Division
sDepartment Department
sTeam Team
sGroup Group
sRole Role
sHomePhone Phone (Home)
sFaxPhone Phone (Fax)
sBusinessPhone Phone (Work)
sMailingAddress Address
sMailingAddress2 Suite/Apt
sMailingAddressCity City
sMailingAddressState Region
sMailingAddressPostal Postal Code
sMailingAddressCountry Country
sTitle Job Title
sURL Website
lowercasenamenospaces Custom Fields

Parameters are case sensitive and are defined as an array where the key is the field name.

Example

This great for collecting contact information in one survey and updating a Contact List with that new contact information in another survey. It allows you to gather all your information and automatically set up a follow up list to easily send follow up surveys to your respondents!

In the below example we use sgapiAddContactToList to update contact list 116 with the the email, first name, last name and birthdate collected in the survey.

%%listid = 116;
%%email = sgapiGetValue(2);
%%firstname = sgapiGetValue(3);
%%laststname = sgapiGetValue(4); 
%%birthdate = sgapiGetValue(10); 

%fields = array(‘sFirstName’ => %%firstname, ‘sLastName’ => %%lastname); 
%%customfields = array(‘birthdate’ => %%birthdate); 

sgapiAddContactToList(%%listid, %%email, %%fields, %%customfields);