# Custom Code Output - Is Known

**URL:** <https://community.hubspot.com/t/custom-code-output-is-known/100064>\
**Category:** CMS Development\
**Tags:** javascript\
**Created:** [February 13, 2024, 3:28pm UTC](https://community.hubspot.com/t/custom-code-output-is-known/100064 "2024-02-13T15:28:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EFiori](https://avatars.discourse-cdn.com/v4/letter/e/bbe5ce/32.png) [@EFiori](https://community.hubspot.com/u/EFiori)\
**Post date:** [February 13, 2024, 3:28pm UTC](https://community.hubspot.com/t/custom-code-output-is-known/100064/1 "2024-02-13T15:28:49Z")

</div>

Is is possible to check if the output of a custom code is known?

I have a scenario where there is some custom code that accepts a set of inputs and the same set of output. The problem is the workflow is not always passed the full set of inputs, as a result I cannot just assign the output of the workflow since it isn’t always defined. I’d like to check if it is present first. Is this possible?

---

<div class="post-metadata">

**Author:** ![SteveHTM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stevehtm/32/22074_2.png) [@SteveHTM](https://community.hubspot.com/u/SteveHTM)\
**Post date:** [February 13, 2024, 6:02pm UTC](https://community.hubspot.com/t/custom-code-output-is-known/100064/2 "2024-02-13T18:02:09Z")

</div>

@EFiori - I hope I am understanding your problem statement correctly - in effect the code logic does not always result in a defined property value that can be passed to the parent workflow.

I have encountered this a number of time in different formats - and my solution in most of these has been the assignment of a default value to the output property as the code initailizes so there is no path through the code that leaves that value undefined.

A trivial example might be code that find the value of a record ID (via a search or similar).

The first few lines of my code might include recordID = “XXXX” (in Python that is).

Then, if the record I’m searching for is found, the a valid digit string is inserted. Otherwise the code can terminate with the “XXXX” value passed back. I use an actual recognizable string here rather than a None assignment because the chances is that a subsequent copy value step willl fail with a None value.

Hope this helps.

Steve

---

<div class="post-metadata">

**Author:** ![EFiori](https://avatars.discourse-cdn.com/v4/letter/e/bbe5ce/32.png) [@EFiori](https://community.hubspot.com/u/EFiori)\
**Post date:** [February 13, 2024, 6:37pm UTC](https://community.hubspot.com/t/custom-code-output-is-known/100064/3 "2024-02-13T18:37:34Z")

</div>

Thanks for your reply.

This picture might illustrate things better - I have an output value that I’m not sure will be present, so I’d like to avoid the copy propety step in that case, but I’m not sure how…

 ![customcode.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/8/9/89f1396ee1ed2bf3ff989edb2274317cec0fe399.png)

---

<div class="post-metadata">

**Author:** ![SteveHTM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stevehtm/32/22074_2.png) [@SteveHTM](https://community.hubspot.com/u/SteveHTM)\
**Post date:** [February 13, 2024, 9:27pm UTC](https://community.hubspot.com/t/custom-code-output-is-known/100064/4 "2024-02-13T21:27:40Z")

</div>

As far as I can tell, the only way right now to skip step 2 per your screenshot is to actually branch on the good value or non-value of the “outcome” code. Which is why I suggest above making sure there is always something other than a Null/None value in the returned code. At least now you can reference that return value directly without an intermediate storage step.
