# Workflow Custom Code Write to Contact Property

**URL:** <https://community.hubspot.com/t/workflow-custom-code-write-to-contact-property/99171>\
**Category:** APIs & Integrations\
**Tags:** workflows\
**Created:** [February 1, 2024, 12:42am UTC](https://community.hubspot.com/t/workflow-custom-code-write-to-contact-property/99171 "2024-02-01T00:42:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![isabeli](https://avatars.discourse-cdn.com/v4/letter/i/51bf81/32.png) [@isabeli](https://community.hubspot.com/u/isabeli)\
**Post date:** [February 1, 2024, 12:42am UTC](https://community.hubspot.com/t/workflow-custom-code-write-to-contact-property/99171/1 "2024-02-01T00:42:39Z")

</div>

Hi all,

Is it possible to write to a Contact property when using the Custom Code in Worflows? I’m using Python. If so, could someone please point me to the documentation?

I’m thinking it should look something like this, but with “update” instead of “get\_by\_id”:

hubspot.crm.contacts.basic\_api.get\_by\_id(hs\_contact\_id, properties=[“phone”])

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [February 1, 2024, 9:10pm UTC](https://community.hubspot.com/t/workflow-custom-code-write-to-contact-property/99171/2 "2024-02-01T21:10:50Z")

</div>

Hi, @isabeli. Thanks for your question. An easy way to test this is to use the on-page [PATCH example here](https://developers.hubspot.com/docs/api/crm/contacts) (endpoints tab) and use the Python example. This should give you something to take and modify for use in your custom coded workflow action. Additionally, if you have already tried to send a similar request, can you share it along with the error being returned, please?

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![isabeli](https://avatars.discourse-cdn.com/v4/letter/i/51bf81/32.png) [@isabeli](https://community.hubspot.com/u/isabeli)\
**Post date:** [February 1, 2024, 10:18pm UTC](https://community.hubspot.com/t/workflow-custom-code-write-to-contact-property/99171/3 "2024-02-01T22:18:17Z")

</div>

Thank you for pointing me to that endpoint! That helped a lot. Here’s what ended up working for me:

```lia-code-sample
 hubspot.crm.contacts.basic_api.update(
 hs_contact_id, 
 {
 "properties": {
 "gclid": "test_gclid",
 }
 }
 )

```

- hs\_contact\_id = Record ID
- gclid is the name of the property I updated
- test\_gclid is the valid that I set gclid to

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [February 1, 2024, 11:06pm UTC](https://community.hubspot.com/t/workflow-custom-code-write-to-contact-property/99171/4 "2024-02-01T23:06:38Z")

</div>

Fantastic! Thank you very much for sharing what worked. Have fun coding! — Jaycee

---

<div class="post-metadata">

**Author:** ![MMatos2](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@MMatos2](https://community.hubspot.com/u/MMatos2)\
**Post date:** [April 17, 2024, 11:57am UTC](https://community.hubspot.com/t/workflow-custom-code-write-to-contact-property/99171/5 "2024-04-17T11:57:12Z")

</div>

but if we are using multiple Property IDs, how do we define which is the correct record ID?

---

<div class="post-metadata">

**Author:** ![NNelson9](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@NNelson9](https://community.hubspot.com/u/NNelson9)\
**Post date:** [May 2, 2024, 11:30pm UTC](https://community.hubspot.com/t/workflow-custom-code-write-to-contact-property/99171/6 "2024-05-02T23:30:35Z")

</div>

I am trying to do the same thing here, but it’s not working for me. Is this the whole code?
