# Workflow actions based on a custom code execution (success / error)?

**URL:** <https://community.hubspot.com/t/workflow-actions-based-on-a-custom-code-execution-success-error/83130>\
**Category:** Data Hub\
**Tags:** workflow-extension\
**Created:** [June 12, 2023, 9:13am UTC](https://community.hubspot.com/t/workflow-actions-based-on-a-custom-code-execution-success-error/83130 "2023-06-12T09:13:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smuli](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/smuli/32/9140_2.png) [@Smuli](https://community.hubspot.com/u/Smuli)\
**Post date:** [June 12, 2023, 9:13am UTC](https://community.hubspot.com/t/workflow-actions-based-on-a-custom-code-execution-success-error/83130/1 "2023-06-12T09:13:01Z")

</div>

Hello!  
Is there a way to build if/then (success/error) logic on a workflow following a custom code execution and its result?  
I’d like to send notifications (or trigger other actions) based on if the code was successfully executed or not, but could not figure out a way to do that myself. However it sounds like such a must-have feature, I’m sure someone has solved this already?

 ![Näyttökuva 2023-6-12 kello 12.10.49.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/6/4650cdf4db8eea714c30c8ba16c73f75d4698344.png)

---

<div class="post-metadata">

**Author:** ![kvlschaefer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kvlschaefer/32/71076_2.png) [@kvlschaefer](https://community.hubspot.com/u/kvlschaefer)\
**Post date:** [June 13, 2023, 12:47pm UTC](https://community.hubspot.com/t/workflow-actions-based-on-a-custom-code-execution-success-error/83130/2 "2023-06-13T12:47:18Z")

</div>

Hi @Smuli,

Thanks for reaching out to the Community!

I wanted to refer you to this [related post](https://community.hubspot.com/t5/CMS-Development/Workflow-Custom-Code-Event-Status/td-p/760174) in our Developer’s Forum where @louischausse explains how you can achieve this.

Best,

Kristen

---

<div class="post-metadata">

**Author:** ![louischausse](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/louischausse/32/18067_2.png) [@louischausse](https://community.hubspot.com/u/louischausse)\
**Post date:** [June 13, 2023, 1:49pm UTC](https://community.hubspot.com/t/workflow-actions-based-on-a-custom-code-execution-success-error/83130/3 "2023-06-13T13:49:12Z")

</div>

Hi @Smuli ,  
The related post suggested by @kvlschaefer is relevant if you want to create custom success/error output messages, but you can also use standard success/error output from custom coded actions.  
Either way, you can’t used them in a “If/Then branch” action. You need to use “[Value equals branch](https://knowledge.hubspot.com/workflows/choose-your-workflow-actions#:~:text=Value%20equals%20branch,a%20single%20property.)” instead.

 ![louischausse_0-1686664145656.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/4/a4ab37844251529de1fbeb8c5071a71d4b5813d8.png)

Don’t forget to mark my reply as a solution if you are satisfied. If not, do not hesitate to ask me anything!

---

<div class="post-metadata">

**Author:** ![Smuli](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/smuli/32/9140_2.png) [@Smuli](https://community.hubspot.com/u/Smuli)\
**Post date:** [June 13, 2023, 1:59pm UTC](https://community.hubspot.com/t/workflow-actions-based-on-a-custom-code-execution-success-error/83130/4 "2023-06-13T13:59:31Z")

</div>

Thank you, this was exactly what I was looking for!
