Not being able to create forms with custom fields

Hello everyone.
I’m using the Forms api v3 to create and submit forms and i’m not being able to define fields that are not existing in the objects already existing in Hubpost (like the Contact, Company, etc).
For example, here’s a field that we want to create but the api fails when including it:

...
{
 "groupType": "default_group",
 "richTextType": "text",
 "fields": [
 {
 "objectTypeId": "0-1",
 "name": "campaign_name",
 "label": "Campaign Name",
 "required": False,
 "hidden": False,
 "fieldType": "single_line_text",
 },
 ],
},
...

The weirdest thing is that this works when I want to create this form in the test account given by hubspot in the developer account. But, when I want to create this form in any other account a not very descriptive error appears (internal error).
If anyone has a clue of what is happening I appreciate the help. Thanks!

@JBetarte - am I reading the post correctly? That you want the form API to create the new property and fill it’s value? I believe that would need to be a two step process. Sorry if I have misunderstood.

Steve

Yeah, eventually i want to send submissions to that form. But my problem it’s just when creating the Form (the first step of the process).

The best approach here is:

- create the property definitions, including rules, choices etc. using the properties UI setting screen. There are many advantages to doing this here. (You could also achieve the same thing throigh the properties API).

- create the form using those property fields.

- fill the form using your submit API call.

Steve