Adding a Custom Dropdown Field to a Contact Record in Ontraport using the API

Ontraport allows you to add custom fields to contact records. There are various field types:

  • Checkbox – Checkbox for yes and no values.
  • Country – Dropdown list for Countries
  • Date – Calendar box to select date.
  • List Selection – List of multiple values; allows selection of one or more.
  • Long Text – Text field for long descriptions.
  • Numeric – Field for whole numbers only.
  • Price – Field for entering a price.
  • Phone – Field for phone numbers.
  • State – Contains a list of states and regions.
  • Dropdown – Dropdown list of multiple values allowing the selection of one of the values.
  • Color – Dropdown list of multiple values allowing the selection of one of the values and color
  • Text – Field for alpha-numeric values such as proper names, serial numbers, etc.
  • Email – Field for email address.
  • SMS – Field for a phone number that can receive SMS messages.
  • Address – Field for a street address.

When you’re adding a Dropdown or List Selection field, you sometimes have lots of options to add, and adding them manually within the Ontraport app can be a bit arduous. It would be nice to be able to import them.

Well, if you can get your options into a comma-delimited list, you can do just that within Ontraport’s live API interface.

Let’s say you want to add a custom field to your contact records in the Contact Information section called “NY County” with a selection of 62 options (there are 62 counties in New York state).

Well, you can use the “POST /objects/fieldeditor (https://api.ontraport.com/1/objects/fieldeditor)” API endpoint and send it a JSON string that looks like this:

{  
   "objectID":0,
   "name":"Contact Information",
   "fields":[  
      [  
         {  
            "alias":"NY County",
            "type":"drop",
            "required":0,
            "unique":0,
            "options":{  
               "add":[  
                  "Albany",
                  "Allegany",
                  "Bronx",
                  "Broome",
                  "Cattaraugus",
                  "Cayuga",
                  "Chautauqua",
                  "Chemung",
                  "Chenango",
                  "Clinton",
                  "Columbia",
                  "Cortland",
                  "Delaware",
                  "Dutchess",
                  "Erie",
                  "Essex",
                  "Franklin",
                  "Fulton",
                  "Genesee",
                  "Greene",
                  "Hamilton",
                  "Herkimer",
                  "Jefferson",
                  "Kings",
                  "Lewis",
                  "Livingston",
                  "Madison",
                  "Monroe",
                  "Montgomery",
                  "Nassau",
                  "New York",
                  "Niagara",
                  "Oneida",
                  "Onondaga",
                  "Ontario",
                  "Orange",
                  "Orleans",
                  "Oswego",
                  "Otsego",
                  "Putnam",
                  "Queens",
                  "Rensselaer",
                  "Richmond",
                  "Rockland",
                  "Saint Lawrence",
                  "Saratoga",
                  "Schenectady",
                  "Schoharie",
                  "Schuyler",
                  "Seneca",
                  "Steuben",
                  "Suffolk",
                  "Sullivan",
                  "Tioga",
                  "Tompkins",
                  "Ulster",
                  "Warren",
                  "Washington",
                  "Wayne",
                  "Westchester",
                  "Wyoming",
                  "Yates"
               ],
               "remove":[  

               ],
               "replace":[  

               ]
            }
         }
      ]
   ]
}

This is the JSON string you use to make it a drop-down list (note: it specifies type=”drop”). If you want to make it a multiple selection list instead, you would use type: “list”.

If your custom field already exists and you’re just adding more options, you can use a JSON string that looks just like this, however you would use the “PUT /objects/fieldeditor (https://api.ontraport.com/1/objects/fieldeditor)” API endpoint instead.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.