Create Custom Field List Box using API

Our app dynamically created a Drilldown (Select) Custom Field successfully before. Now, we need to dynamically create a List Box. But I can’t seem to figure out the correct “DataType” value for it.

WHAT WE DID:
We’re about to send these values to DataService.addCustomField

array:4 [▼
  "customFieldType" => "Contact"
  "displayName" => "XXXXX"
  "dataType" => "Option List" // <-- what we need to figure out
  "headerId" => 47
]

We then get an error that says:

[InvalidParameter]The data type “Option List” is an invalid type

WHAT WE TRIED:

  1. We tried to look for something in this guide. However, it only mentions Text, Select (Used for Dropdown), TextArea. It didn’t say anything about “List Box”.

  2. We also checked here but it also doesn’t say anything about what “dataType” to use when creating “List Box” thru the API.

  3. We tried doing all these below as a possible “dataType” values to create List Box. But the same “invalid type” error still shows.

List Box
ListBox
List
Box
Options
Option
Option List
OptionList
Options List
Option Lists
Options Lists
“17” <-- sent as a string, because ListBox DataType integer is 17.
17 <-- sent as an integer. Returns “no method matching args” error instead.

  1. Lastly, we tried creating a record directly at DataFormField group by executing

request('DataService.add', 'DataFormField', $values)

With values:

$values = [
	"Label" => "XXXXX",
	"DataType" => 17,
	"ListRows" => 0,
	"FormId" => -1,
	"GroupId" => 47,
	"Name" => "XXXXX"
];

Although no error occurred, but the return value is FALSE. No new custom field was created when checking Infusionsoft too.

QUESTION
Is it possible to create a custom field List Box? and if so, what “DataType” value do we need for it?
Or maybe we missed something from the steps we did above?

Option list is not a data type and the data type field is an enumeration of data types determined in the table documentation. For the drill down it must be set to 23

@John_Borelli oh sorry, thanks for the clarification. But what I mean is we need to create a List Box - where a user can select multiple items from a list:

2020-07-06_09-51-21

And we believe its ID is 17:

So we tried sending 17 as dataType to DataService.addCustomField like so:

array:4 [▼
  "customFieldType" => "Contact"
  "displayName" => "XXXXX"
  "dataType" => "17" // <-- what we need to figure out
  "headerId" => 47
]

But we still get this error:

2020-07-06_10-02-27

Ok, so the format you’re showing doesn’t match either the xml-rpc or rest so which are you using. Let’s start there and work forward :wink:

Oh okay. With regards to the format, we nailed it because we were able to create these three fields below using the xml-rpc guide.

What we don’t know is the “etc.” part. We’re trying to figure out what value to use for ListBox. And we can’t seem to find any documentation for it.

Updating this post for future reference.
Just sent a dev ticket, and they advised to use “MultiSelect”. It works now!

array:4 [▼
  "customFieldType" => "Contact"
  "displayName" => "XXXXX"
  "dataType" => "MultiSelect" // <-- this works
  "headerId" => 47
]
1 Like