APIs & Integrations

AMGorilla
Participant

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)

  • Inputs specified in the code step:

     

    • subject — Ticket

    • hs_object_id — Ticket

     

  • debug_log ← Action outputs → Custom Code → 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:

  1. Properties like subject are passed in and accessible?

  2. 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.

0 Upvotes
2 Accepted solutions
MichaelMa
Solution
Contributor

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.

View solution in original post

0 Upvotes
AMGorilla
Solution
Participant

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:

Screenshot 2025-05-10 at 8.04.36 am.png

and wrapping the return inside outputFields aligns with the working pattern we needed. We’ll update the script and test again.

 

Appreciate the help — this was the missing piece.

View solution in original post

0 Upvotes
4 Replies 4
AMGorilla
Participant

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:

 

Screenshot 2025-05-10 at 6.56.20 am.png

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?

0 Upvotes
MichaelMa
Solution
Contributor

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.

0 Upvotes
AMGorilla
Solution
Participant

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:

Screenshot 2025-05-10 at 8.04.36 am.png

and wrapping the return inside outputFields aligns with the working pattern we needed. We’ll update the script and test again.

 

Appreciate the help — this was the missing piece.

0 Upvotes
MichaelMa
Contributor

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?

 

MichaelMa_3-1746798081067.png

 

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
    }
  });
}

 

MichaelMa_4-1746798312033.png

 

Once you confirmed that the output is fine, it's mostly selecting the correct items:

MichaelMa_6-1746798497577.png