APIs & Integrations

dan9
Member

"days_to_close" is a read only property; its value cannot be set

SOLVE

I'm trying to modify the Close Date of deals but I get this error message:

 

"days_to_close" is a read only property; its value cannot be set

 

Is it not possible to do that?

1 Accepted solution
Jaycee_Lewis
Solution
Community Manager
Community Manager

"days_to_close" is a read only property; its value cannot be set

SOLVE

Hey, @dan9 👋 You are not missing anything. Properties marked read-only cannot be modified. By making a request to the Properties API, we can get more details.

 

In this case, “days_to_close” is a calculation property. Calculation properties are built from two or more properties. This is why you cannot edit the property. You may be able to edit one of the properties that make up the calculation, but not the calculation property itself — e.g. “closedate” or “createdate”.

 

Example request and response:

  • Request
    curl --request GET \
      --url 'https://api.hubapi.com/crm/v3/properties/0-3/days_to_close?archived=false' \
      --header 'authorization: Bearer YOUR_ACCESS_TOKEN'​
  • Response
    HTTP 200
    
    {
      "updatedAt": "2022-05-27T23:45:00.102Z",
      "createdAt": "2019-08-06T02:41:52.984Z",
      "name": "days_to_close",
      "label": "Days to close",
      "type": "number",
      "fieldType": "calculation_equation",
      "description": "The number of days the deal took to close",
      "groupName": "dealinformation",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": true,
      "hasUniqueValue": false,
      "hidden": true,
      "hubspotDefined": true,
      "showCurrencySymbol": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": true,
        "readOnlyValue": true
      },
      "formField": false,
      "calculationFormula": "max(0, round_down(((closedate - createdate) / 86400000), 0))"
    }​

CleanShot 2023-03-21 at 14.31.59.png

If you need to edit a property like Days to Close, you'll need to consider creating a custom property and using a date picker or single line text field-type. As there is not a method to get around the read-only flag for properties.

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

View solution in original post

2 Replies 2
dan9
Member

"days_to_close" is a read only property; its value cannot be set

SOLVE

closedate was what I was looking for, thanks

Jaycee_Lewis
Solution
Community Manager
Community Manager

"days_to_close" is a read only property; its value cannot be set

SOLVE

Hey, @dan9 👋 You are not missing anything. Properties marked read-only cannot be modified. By making a request to the Properties API, we can get more details.

 

In this case, “days_to_close” is a calculation property. Calculation properties are built from two or more properties. This is why you cannot edit the property. You may be able to edit one of the properties that make up the calculation, but not the calculation property itself — e.g. “closedate” or “createdate”.

 

Example request and response:

  • Request
    curl --request GET \
      --url 'https://api.hubapi.com/crm/v3/properties/0-3/days_to_close?archived=false' \
      --header 'authorization: Bearer YOUR_ACCESS_TOKEN'​
  • Response
    HTTP 200
    
    {
      "updatedAt": "2022-05-27T23:45:00.102Z",
      "createdAt": "2019-08-06T02:41:52.984Z",
      "name": "days_to_close",
      "label": "Days to close",
      "type": "number",
      "fieldType": "calculation_equation",
      "description": "The number of days the deal took to close",
      "groupName": "dealinformation",
      "options": [],
      "displayOrder": -1,
      "calculated": false,
      "externalOptions": true,
      "hasUniqueValue": false,
      "hidden": true,
      "hubspotDefined": true,
      "showCurrencySymbol": false,
      "modificationMetadata": {
        "archivable": true,
        "readOnlyDefinition": true,
        "readOnlyValue": true
      },
      "formField": false,
      "calculationFormula": "max(0, round_down(((closedate - createdate) / 86400000), 0))"
    }​

CleanShot 2023-03-21 at 14.31.59.png

If you need to edit a property like Days to Close, you'll need to consider creating a custom property and using a date picker or single line text field-type. As there is not a method to get around the read-only flag for properties.

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot