# Setting a contact property with a value extracted from a code action.

**URL:** <https://community.hubspot.com/t/setting-a-contact-property-with-a-value-extracted-from-a-code-action/134689>\
**Category:** APIs & Integrations\
**Tags:** starter\
**Created:** [June 18, 2025, 6:29am UTC](https://community.hubspot.com/t/setting-a-contact-property-with-a-value-extracted-from-a-code-action/134689 "2025-06-18T06:29:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Igee](https://avatars.discourse-cdn.com/v4/letter/i/c37758/32.png) [@Igee](https://community.hubspot.com/u/Igee)\
**Post date:** [June 18, 2025, 6:29am UTC](https://community.hubspot.com/t/setting-a-contact-property-with-a-value-extracted-from-a-code-action/134689/1 "2025-06-18T06:29:32Z")

</div>

Hello I need to save some data after to a contact property after getting checked through an API call.

```lia-code-sample
 callback({
 botMessage: outputMessage
 responseExpected: false,
 customState: {
 hasValidCode: hasValidCode,
 customResponse: customResponse
 },
 outputFields: {
 //Output Variables to be called outside the code action using double curly braces (Example: {{codeExtracted}})
 codeExtracted: validCode
 }

 });

```

I was told that the outputFields in callback can be used in subsequent actions when referenced as {{codeExtracted}}, but this doesn’t work currently.

Currently I am trying to set this on the action right after the code snippet.

Should this be done using another method?

---

<div class="post-metadata">

**Author:** ![ChrisoKlepke](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/chrisoklepke/32/11213_2.png) [@ChrisoKlepke](https://community.hubspot.com/u/ChrisoKlepke)\
**Post date:** [June 18, 2025, 11:36am UTC](https://community.hubspot.com/t/setting-a-contact-property-with-a-value-extracted-from-a-code-action/134689/2 "2025-06-18T11:36:30Z")

</div>

Hey @Igee ,

this looks like you’re using a custom coded workflow action from Operations Hub. In that case you have to define the possible output first under the code that needs to be executed, including its data type.

 ![Screenshot 2025-06-18 at 13.32.41.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/0/a081edb60d03b6d57c4b677ec2aba46c6b076004.png)

Next, you need to copy that output to your preferred property using the _Edit Record_ action. First pick the property that needs to be copied to and then select _Action Outputs_ and the output _codeExtracted._

 ![Screenshot 2025-06-18 at 13.33.14.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/4/94151403c3a8328ee0c041d5ba52a7dbc914d418.png)

If you found this post helpful, consider helping others in the community to find answers faster by marking this as a solution. I’d really appreciate it.

Best,

Chriso

---

<div class="post-metadata">

**Author:** ![Igee](https://avatars.discourse-cdn.com/v4/letter/i/c37758/32.png) [@Igee](https://community.hubspot.com/u/Igee)\
**Post date:** [June 19, 2025, 6:07am UTC](https://community.hubspot.com/t/setting-a-contact-property-with-a-value-extracted-from-a-code-action/134689/3 "2025-06-19T06:07:40Z")

</div>

Can this be done in a chatflow custom code action as well?
