APIs & Integrations

CTHDigital
Member

Issue with Adding Checkbox Field to Action Definition in HubSpot

I am experiencing a problem when attempting to add a new checkbox field (objectChoice) to an existing action definition in my HubSpot configuration. Despite my efforts to align with the API documentation and requirements, I keep encountering a validation error, specifically concerning the addition of this new required field.

I am hoping to get some insights or guidance on how to resolve this issue effectively.



curl --location --globoff --request PATCH 'https://api.hubapi.com/automation/v4/actions/{app-id}/{definition-id}?hapikey={key}' \
--header 'content-type: application/json' \
--data '{
"actionUrl": "https://thdigital.au/notes/staging/actions/create_note/index.php",
"published": true,
"inputFields": [
{
"typeDefinition": {
"name": "selectOwner",
"type": "enumeration",
"fieldType": "select",
"options": [
{
"label": "An Existing Owner Of Record",
"value": "existingOwner"
},
{
"label": "Specific User",
"value": "specificOwner"
}
],
"optionsUrl": null,
"referencedObjectType": null,
"externalOptions": false,
"externalOptionsReferenceType": null
},
"supportedValueTypes": [
"STATIC_VALUE"
],
"isRequired": true,
"automationFieldType": null
},
{
"typeDefinition": {
"name": "Owner",
"type": "enumeration",
"fieldType": null,
"options": [],
"optionsUrl": null,
"referencedObjectType": "OWNER",
"externalOptions": false,
"externalOptionsReferenceType": null
},
"supportedValueTypes": [
"STATIC_VALUE"
],
"isRequired": true,
"automationFieldType": null
},
{
"typeDefinition": {
"name": "radio",
"type": "enumeration",
"fieldType": "radio",
"options": [
{
"label": "Date Of Step",
"value": "stepDate",
"description": "Date of step"
},
{
"label": "Static Date",
"value": "staticDate",
"description": "Select Static Date"
}
],
"optionsUrl": null,
"referencedObjectType": null,
"externalOptions": false,
"externalOptionsReferenceType": null
},
"supportedValueTypes": [
"STATIC_VALUE"
],
"isRequired": true,
"automationFieldType": null
},
{
"typeDefinition": {
"name": "date",
"type": "date",
"fieldType": "date",
"options": [],
"optionsUrl": null,
"referencedObjectType": null,
"externalOptions": false,
"externalOptionsReferenceType": null
},
"supportedValueTypes": [
"STATIC_VALUE"
],
"isRequired": true,
"automationFieldType": null
},
{
"typeDefinition": {
"name": "objectChoice",
"type": "enumeration",
"fieldType": "checkbox",
"options": [
{
"value": "company",
"label": "Do you want to assign it with the associated Company?"
},
{
"value": "deal",
"label": "Do you want to assign it with the associated Deal?"
}
],
"isRequired": false,
"automationFieldType": null
},
"supportedValueTypes": [
"STATIC_VALUE"
]
},
{
"typeDefinition": {
"name": "Body",
"type": "string",
"fieldType": "textarea",
"options": [],
"optionsUrl": null,
"referencedObjectType": null,
"externalOptions": false,
"externalOptionsReferenceType": null
},
"supportedValueTypes": [
"STATIC_VALUE"
],
"isRequired": true,
"automationFieldType": null
}
],
"objectRequestOptions": null,
"inputFieldDependencies": [
{
"dependencyType": "CONDITIONAL_SINGLE_FIELD",
"controllingFieldName": "radio",
"controllingFieldValue": "staticDate",
"dependentFieldNames": [
"date"
]
},
{
"dependencyType": "CONDITIONAL_SINGLE_FIELD",
"controllingFieldName": "selectOwner",
"controllingFieldValue": "specificOwner",
"dependentFieldNames": [
"Owner"
]
}
],
"labels": {
"en": {
"actionName": "Create Note",
"actionDescription": "This action will create a new Note in our system.",
"actionCardContent": "Create Custom Note",
"inputFieldLabels": {
"date": "Select Date",
"radio": "Select type",
"selectOwner": "Select Owner",
"objectChoice": "Select Object",
"Body": "Body"
},
"inputFieldDescriptions": {
"Date": "Enter Date"
}
}
},
"objectTypes": [
"CONTACT",
"DEAL",
"COMPANY",
"TICKET",
"2-8828424",
"2-12251661",
"2-14905975",
"2-13764992",
"2-9468726",
"2-11078864",
"2-14908305"
]
}'
Error Response:

{
"status": "error",
"message": "Invalid action definition",
"correlationId": "dc9e2975-080a-44b8-9bb9-9f07f49e1e7a",
"errors": [
{
"subCategory": "ActionDefinitionValidationError.BACKWARDS_INCOMPATIBLE_CHANGE_NEW_REQUIRED_FIELD",
"message": "Can't add required field `objectChoice` as this would break existing actions. Please make a new action or make the new field optional.",
"context": {
"fieldName": [
"objectChoice"
]
}
}
],
"category": "VALIDATION_ERROR"
}

Based on the error message, it seems that adding this new field as required is considered a backward-incompatible change. However, I am unsure how to proceed, as making the field optional or creating a new action might not align with our application's requirements and workflow.

 

Thank you in advance for your time and help.

Best regards, 
Abdul manan

0 Upvotes
2 Replies 2
CTHDigital
Member

Issue with Adding Checkbox Field to Action Definition in HubSpot

@Jaycee_Lewis  I've already tried this the required value to optional, I'd added this field with "isRequired"= false but it doesn't work.
{
"typeDefinition": {
"name": "objectChoice",
"type": "enumeration",
"fieldType": "checkbox",
"options": [
{
"value": "company",
"label": "Do you want to assign it with the associated Company?"
},
{
"value": "deal",
"label": "Do you want to assign it with the associated Deal?"
}
],
"isRequired": false,
"automationFieldType": null
},
"supportedValueTypes": [
"STATIC_VALUE"
]
},

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Issue with Adding Checkbox Field to Action Definition in HubSpot

Hi, @CTHDigital 👋 The error returned is correct. The documentation does not provide us with a workaround or additional method to bypass this limitation. It's likely there are underlying reasons for backwards compatibility being enforced this way.

 

You listed the two options we have documented and available:

  • Make the Field Optional
  • Create a New Action with the Required Field

We'll leave this open in case other community members have suggestions or thoughts on how they would approach this roadblock.

 

Best,

Jaycee

 

 

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes