Custom Code in Ticket-Based Workflow Not Receiving Inputs or Writing Outputs”
SOLVE
Hi all,
We’re running into what looks like either a limitation or a silent failure inside HubSpot’s internal Custom Code actions within ticket-based workflows, and I’d like to know if anyone else has encountered this.
Setup:
Workflow Type: Ticket-based
Using a Custom Code action to extract an order number from the ticket name (subject) and write it to a custom property (debug_log)
Output is mapped via a “Set property value” action:
Observed Behavior:
Workflow runs and shows as completed successfully
Ticket does not update
debug_log remains blank
Even static values (like “RUN TEST 001”) don’t write
Confirmed subject is never passed into the custom code (comes through as empty)
What’s Already Verified:
Workflow is running in Sandbox (and mirrored in Prod)
User is Super Admin
debug_log is a custom property on Tickets, type: single-line text
All field mappings are correct
Rebuilt the workflow multiple times from scratch
Input and output property names are all correct
Confirmed no permission issues, no read-only fields, no conditional branches blocking execution
Ask:
Has anyone successfully used Custom Code actions in ticket-based workflows where:
Properties like subject are passed in and accessible?
Outputs can be written to ticket properties?
I’ve already escalated this to HubSpot Support, but posting here in case it’s a broader issue others have encountered or if someone from the product/dev team is monitoring.
Thanks in advance. Happy to share screenshots or configuration details if helpful.
Custom Code in Ticket-Based Workflow Not Receiving Inputs or Writing Outputs”
SOLVE
My response is still the same except change my NodeJS code to Python.
You need to use Output fields if you want to pass the data to other nodes. If you create a new Custom Coded action node, the default code presented (in Python) has a lot of the default functionality that you would need.
event is the primary variable that the nodes uses to access the data. event['inputFields'] are where it stores the properties you added in the Custom Coded Action.
OutputFields is how it passes data out from the node and able to access it to other nodes so you have to use that so it's accessible by other nodes.
So presuming the same as before but using Python:
def main(event):
debug_log = event["inputFields"]["subject"]
print (debug_log)
# Return the output data that can be used in later actions in your workflow.
return {
"outputFields": {
"debug_log": debug_log
}
}
So if you test the Custom Coded Action node, you can see the output data and logs.
Custom Code in Ticket-Based Workflow Not Receiving Inputs or Writing Outputs”
SOLVE
Thanks for this — that clears things up.
We were previously using input.get('subject') and returning data directly in the root return object instead of using outputFields. Your Python example using:
and wrapping the return inside outputFields aligns with the working pattern we needed. We’ll update the script and test again.
Custom Code in Ticket-Based Workflow Not Receiving Inputs or Writing Outputs”
SOLVE
Thanks for the response — I appreciate you jumping in.
Just to clarify: this workflow is using HubSpot’s internal Custom Code Action (built directly in the workflow editor), not a private app or external function. That means it’s Python-based, and the standard format is:
We’ve explicitly included subject — Ticket as a property to include. Despite that, the value doesn’t come through — even when hardcoding the return value in the code step, the ticket property (debug_log) doesn’t update.
So far we’ve:
Verified property names and types
Confirmed correct input/output mapping
Manually enrolled test tickets
Used Super Admin permissions
Rebuilt the workflow from scratch
Still getting no values on output, and no subject being passed into input.
Do you know of any current limitations or known bugs with internal Custom Code Actions inside ticket-based workflows not binding inputs properly?
Custom Code in Ticket-Based Workflow Not Receiving Inputs or Writing Outputs”
SOLVE
My response is still the same except change my NodeJS code to Python.
You need to use Output fields if you want to pass the data to other nodes. If you create a new Custom Coded action node, the default code presented (in Python) has a lot of the default functionality that you would need.
event is the primary variable that the nodes uses to access the data. event['inputFields'] are where it stores the properties you added in the Custom Coded Action.
OutputFields is how it passes data out from the node and able to access it to other nodes so you have to use that so it's accessible by other nodes.
So presuming the same as before but using Python:
def main(event):
debug_log = event["inputFields"]["subject"]
print (debug_log)
# Return the output data that can be used in later actions in your workflow.
return {
"outputFields": {
"debug_log": debug_log
}
}
So if you test the Custom Coded Action node, you can see the output data and logs.
Custom Code in Ticket-Based Workflow Not Receiving Inputs or Writing Outputs”
SOLVE
Thanks for this — that clears things up.
We were previously using input.get('subject') and returning data directly in the root return object instead of using outputFields. Your Python example using:
and wrapping the return inside outputFields aligns with the working pattern we needed. We’ll update the script and test again.
Custom Code in Ticket-Based Workflow Not Receiving Inputs or Writing Outputs”
SOLVE
Confirmed subject is never passed into the custom code (comes through as empty)
How are you accessing the data? Via the property includes?
Are you accessing the variable correctly in your Custom Code?
Eg, here is some simple code to grab the subject from the input fields and output it in the console and passes the variables out.
Properties to include are accessed via the object event.inputFields (case sensitive).
exports.main = async (event, callback) => {
var debug_log = event.inputFields['subject']; //Grabbing ticket name from the passed in vars
console.log("Original Ticket Name:", debug_log)
debug_log = debug_log.replace(/\D/g,'') //Removing Alpha leaving only Numbers
console.log("Process Order ID:", debug_log)
/*****
Use the callback function to output data that can be used in later actions in your workflow.
*****/
callback({
outputFields: {
debug_log: debug_log
}
});
}
Once you confirmed that the output is fine, it's mostly selecting the correct items: