APIs & Integrations

SNajafi
Member

Checking to see if a property of a deal is set or not

I am using the deal API to create a deal,  Then for the same deal, I want to change one of the custom properties that I have added before hand.

 

const properties = {
    [key]: value,
  };
  const SimplePublicObjectInput = { properties };

    const apiResponse = await hubspotClient.crm.deals.basicApi.update(

      dealId,
      SimplePublicObjectInput
    );

 

I have a function that takes the value and the key as parameters

This way I can change the property, then I want to update that property, how ever I want to make sure it is not set before. how can I do that? I found every solution I found was in the legacydocument.  I want to do it using the current API

 

 

 

 

 

 

 

0 Upvotes
1 Reply 1
dennisedson
HubSpot Product Team
HubSpot Product Team

Checking to see if a property of a deal is set or not

@SNajafi 

I am not fully understanding the steps. Going to try to lay it out as I see it.

1.  create deal and set a property

2.  update the property on the deak if it is not set

Does that sound right? 

After you have created the deal, you can store its ID.

Using the newer v3 endpoints, you could do a get request to read the deal and explicitly request for that property in the request.  If it is there, it will return a value, if there is no value, the property will not be returned

 

Get request:

https://api.hubapi.com/crm/v3/objects/deals/DEALID?properties=custompropertygoeshere

0 Upvotes