APIs & Integrations

rbharris1
Colaborador

Change the required properties in a custom object

resolver

I created a custom object in a new portal. The custom object only has one test instance at the moment. When I created the custom object, I specified several required properties. I have since decided only to have one required property (name). I ran an API patch call and successfully (I think) redefined the schema. However, I am unable to delete one of the formerly required properties (close_date).  I have tried to do this from the CRM UI and from the API. The CRM UI tells me that I can't delete it because property is still a required property. Of course, the API delete endpoint doesn't give any meaningful response.

 

Any help would be appreciated.

 

Here's the output for the 'Get existing schema' endpoint for my custom object after patching it to change the requiredProperties value. You'll notice the only defined required property is 'name' :

 

{
  "labels": {
    "singular": "Project",
    "plural": "Projects"
  },
  "requiredProperties": [
    "name"
  ],
  "searchableProperties": [
    "name"
  ],
  "primaryDisplayProperty": "name",
  "secondaryDisplayProperties": [
    "division",
    "amount"
  ],
  "archived": false,
  "restorable": true,
  "metaType": "PORTAL_SPECIFIC",
  "id": "1265528",
  "fullyQualifiedName": "p6610943_project",
  "createdAt": "2021-01-15T13:16:09.296Z",
  "updatedAt": "2021-01-17T16:02:19.736Z",
  "objectTypeId": "2-1265528",
  "properties": [
    {
      "updatedAt": "2021-01-15T13:16:09.418Z",
      "createdAt": "2021-01-15T13:16:09.418Z",
      "name": "amount",
      "label": "Total Contract Price",
      "type": "number",
      "fieldType": "number",
      "description": "",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "archived": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": false,
        "readOnlyValue": false
      },
      "formField": true
    },
    {
      "updatedAt": "2021-01-15T13:16:09.420Z",
      "createdAt": "2021-01-15T13:16:09.420Z",
      "name": "close_date",
      "label": "Close Date",
      "type": "date",
      "fieldType": "date",
      "description": "",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "archived": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": false,
        "readOnlyValue": false
      },
      "formField": false
    },
    {
      "updatedAt": "2021-01-15T13:16:09.431Z",
      "createdAt": "2021-01-15T13:16:09.431Z",
      "name": "division",
      "label": "Division",
      "type": "enumeration",
      "fieldType": "select",
      "description": "",
      "groupName": "project_information",
      "options": [
        {
          "label": "Barrier Cable",
          "value": "barrier_cable",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        },
        {
          "label": "PT-Slab on Grade",
          "value": "pt_sog",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        },
        {
          "label": "Post Tensioning Commercial",
          "value": "pt_commercial",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        },
        {
          "label": "Restoration",
          "value": "restoration",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        }
      ],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "archived": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": false,
        "readOnlyValue": false
      },
      "formField": true
    },
    {
      "name": "hs_all_accessible_team_ids",
      "label": "All accessible team IDs",
      "type": "enumeration",
      "fieldType": "checkbox",
      "description": "The team IDs, including up the team hierarchy, corresponding to all owner referencing properties for this object, both default and custom",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "hasUniqueValue": false,
      "hidden": true,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": true,
        "readOnlyValue": true
      },
      "formField": false
    },
    {
      "name": "hs_created_by_user_id",
      "label": "Created by user ID",
      "type": "number",
      "fieldType": "number",
      "description": "The user that created this object. This value is automatically set by HubSpot and may not be modified.",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": true,
        "readOnlyValue": true
      },
      "formField": false
    },
    {
      "name": "hs_createdate",
      "label": "Object create date/time",
      "type": "datetime",
      "fieldType": "date",
      "description": "The date and time at which this object was created. This value is automatically set by HubSpot and may not be modified.",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": true,
        "readOnlyValue": true
      },
      "formField": false
    },
    {
      "name": "hs_lastmodifieddate",
      "label": "Object last modified date/time",
      "type": "datetime",
      "fieldType": "date",
      "description": "Most recent timestamp of any property update for this object. This includes HubSpot internal properties, which can be visible or hidden. This property is updated automatically.",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": true,
        "readOnlyValue": true
      },
      "formField": false
    },
    {
      "name": "hs_merged_object_ids",
      "label": "Merged object IDs",
      "type": "enumeration",
      "fieldType": "checkbox",
      "description": "The list of object IDs that have been merged into this object. This value is automatically set by HubSpot and may not be modified.",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "hasUniqueValue": false,
      "hidden": true,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": true,
        "readOnlyValue": true
      },
      "formField": false
    },
    {
      "name": "hs_object_id",
      "label": "Object ID",
      "type": "number",
      "fieldType": "number",
      "description": "The unique ID for this object. This value is automatically set by HubSpot and may not be modified.",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": true,
        "readOnlyValue": true
      },
      "formField": false
    },
    {
      "name": "hs_updated_by_user_id",
      "label": "Updated by user ID",
      "type": "number",
      "fieldType": "number",
      "description": "The user that last updated this object. This value is automatically set by HubSpot and may not be modified.",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": true,
        "readOnlyValue": true
      },
      "formField": false
    },
    {
      "name": "hs_user_ids_of_all_owners",
      "label": "User IDs of all owners",
      "type": "enumeration",
      "fieldType": "checkbox",
      "description": "The user IDs of all owners of this object",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "hasUniqueValue": false,
      "hidden": true,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": true,
        "readOnlyValue": true
      },
      "formField": false
    },
    {
      "updatedAt": "2021-01-15T13:16:09.432Z",
      "createdAt": "2021-01-15T13:16:09.432Z",
      "name": "name",
      "label": "Project Name",
      "type": "string",
      "fieldType": "text",
      "description": "",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "archived": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": false,
        "readOnlyValue": false
      },
      "formField": true
    },
    {
      "updatedAt": "2021-01-15T14:01:20.185Z",
      "createdAt": "2021-01-15T14:01:20.185Z",
      "name": "project_owner",
      "label": "Project Owner",
      "type": "enumeration",
      "fieldType": "OWNER",
      "description": "HubSpot user who owns the project",
      "groupName": "project_information",
      "options": [],
      "createdUserId": "10265915",
      "updatedUserId": "10265915",
      "referencedObjectType": "OWNER",
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": true,
      "archived": false,
      "hasUniqueValue": false,
      "hidden": false,
      "showCurrencySymbol": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": false,
        "readOnlyValue": false
      },
      "formField": false
    },
    {
      "updatedAt": "2021-01-15T13:16:09.433Z",
      "createdAt": "2021-01-15T13:16:09.433Z",
      "name": "sf_project_id",
      "label": "Salesforce Project ID",
      "type": "string",
      "fieldType": "text",
      "description": "",
      "groupName": "project_information",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "archived": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": false,
        "readOnlyValue": false
      },
      "formField": false
    },
    {
      "updatedAt": "2021-01-15T13:16:09.419Z",
      "createdAt": "2021-01-15T13:16:09.419Z",
      "name": "stage",
      "label": "Stage",
      "type": "enumeration",
      "fieldType": "select",
      "description": "",
      "groupName": "project_information",
      "options": [
        {
          "label": "Award",
          "value": "award",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        },
        {
          "label": "Budgetary",
          "value": "budgetary",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        },
        {
          "label": "Cancelled",
          "value": "cancelled",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        },
        {
          "label": "Closed Lost",
          "value": "closed_lost",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        },
        {
          "label": "Closed Won",
          "value": "closed_won",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        },
        {
          "label": "Intermediate Proposal",
          "value": "intermediate_proposal",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        },
        {
          "label": "Negotiation",
          "value": "negotiation",
          "description": "",
          "displayOrder": -1,
          "hidden": false
        }
      ],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": false,
      "archived": false,
      "hasUniqueValue": false,
      "hidden": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": false,
        "readOnlyValue": false
      },
      "formField": false
    }
  ],
  "associations": [
    {
      "fromObjectTypeId": "2-1265528",
      "toObjectTypeId": "0-49",
      "name": "project_to_email",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "7",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "0-49",
      "toObjectTypeId": "2-1265528",
      "name": "project_to_email",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "8",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "2-1265528",
      "toObjectTypeId": "0-46",
      "name": "project_to_note",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "1",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "0-46",
      "toObjectTypeId": "2-1265528",
      "name": "project_to_note",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "2",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "2-1265528",
      "toObjectTypeId": "0-2",
      "name": "project_to_company",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "15",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "0-2",
      "toObjectTypeId": "2-1265528",
      "name": "project_to_company",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "16",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "2-1265528",
      "toObjectTypeId": "0-3",
      "name": "project_to_deal",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "13",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "0-3",
      "toObjectTypeId": "2-1265528",
      "name": "project_to_deal",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "14",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "2-1265528",
      "toObjectTypeId": "0-51",
      "name": "project_to_conversation_session",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "9",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "0-51",
      "toObjectTypeId": "2-1265528",
      "name": "project_to_conversation_session",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "10",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "2-1265528",
      "toObjectTypeId": "0-47",
      "name": "project_to_meeting_event",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "3",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "0-47",
      "toObjectTypeId": "2-1265528",
      "name": "project_to_meeting_event",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "4",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "2-1265528",
      "toObjectTypeId": "0-48",
      "name": "project_to_call",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "11",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "0-48",
      "toObjectTypeId": "2-1265528",
      "name": "project_to_call",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "12",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "2-1265528",
      "toObjectTypeId": "0-27",
      "name": "project_to_task",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "5",
      "createdAt": null,
      "updatedAt": null
    },
    {
      "fromObjectTypeId": "0-27",
      "toObjectTypeId": "2-1265528",
      "name": "project_to_task",
      "cardinality": "ONE_TO_MANY",
      "inverseCardinality": "ONE_TO_MANY",
      "id": "6",
      "createdAt": null,
      "updatedAt": null
    }
  ],
  "name": "project"
}

 

 

Here are the screenshots from the CRM properties settings showing me that the close_date property is still required.

 

Screenshot from 2021-01-17 11-26-55.pngScreenshot from 2021-01-17 11-27-17.png

0 Me gusta
1 Soluciones aceptada
rbharris1
Solución
Colaborador

Change the required properties in a custom object

resolver

So, I managed to figure this one out. I don't know if this is a new feature in Custom Objects since I first had the problem or if this was there all along and just not well documented.

 

The "required" setting preventing deletion was in Settings under the "Set fields seen when creating Projects" area under "Custom Objects." I clicked "Make it optional" there and voila! I can delete the property!

Screen Shot 2021-02-11 at 7.37.58 PM.pngScreen Shot 2021-02-11 at 7.38.27 PM.png

 

Ver la solución en mensaje original publicado

5 Respuestas 5
nkotlyarov
Miembro

Change the required properties in a custom object

resolver

So it looks like the accepted solution does not work in 2022, but I managed to do the following in Python API:

 

from hubspot.crm.schemas import ObjectTypeDefinitionPatch

object_patch = ObjectTypeDefinitionPatch(primary_display_property='my_property', required_properties=['my_property'], searchable_properties=['my_property'])
hubspot_client.crm.schemas.core_api.update(object_type=MY_OBJECT_TYPE, object_type_definition_patch=object_patch)

 

So the idea is to reset all the parts of the object schema where the old column is used (primary_display_property, required_properties, and searchable_properties in my case)

)

0 Me gusta
rbharris1
Solución
Colaborador

Change the required properties in a custom object

resolver

So, I managed to figure this one out. I don't know if this is a new feature in Custom Objects since I first had the problem or if this was there all along and just not well documented.

 

The "required" setting preventing deletion was in Settings under the "Set fields seen when creating Projects" area under "Custom Objects." I clicked "Make it optional" there and voila! I can delete the property!

Screen Shot 2021-02-11 at 7.37.58 PM.pngScreen Shot 2021-02-11 at 7.38.27 PM.png

 

dennisedson
Equipo de producto de HubSpot
Equipo de producto de HubSpot

Change the required properties in a custom object

resolver

@rbharris1 

Thanks for posting your solution.  Looks like I lost track of your response and never got back to you 😥.  Apologies for that

0 Me gusta
dennisedson
Equipo de producto de HubSpot
Equipo de producto de HubSpot

Change the required properties in a custom object

resolver

Hey @rbharris1 

Did you figure this out?

What was your patch request json body? 

 

0 Me gusta
rbharris1
Colaborador

Change the required properties in a custom object

resolver

@dennisedson I haven't yet figured this out. Here's my JSON patch request body. I'm pretty certain that it was successfully delivered/executed because originally, after I first created the custom object, when I ran the Get Existing Schema endpoint the requiredProperties property listed several properties. Unfortunately, I didn't save a copy of that output. 

 

{
  "requiredProperties": [
    "name"
  ]
}

I sent this request using the patch method to https://api.hubapi.com/crm/v3/schemas/MY_OBJECT_FULLY_QUALIFIED_NAME?hapikey=MY_API_KEY&portalId=MY_...

0 Me gusta