Formatting of a ticket description via custom code

Hey community,
I have automated a new ticket creation. However, the problem is that the ticket description of the automatically created ticket is difficult to read due to a poor format.
I would now like to create a workflow that takes the ticket, formats the ticket description and then overwrites it with the new format via custom code.

Enclosed you will find the custom code I used in the workflow.

The code generally seems to work. I have also defined the property and the data output. Unfortunately, the old ticket description is not overwritten but I dont know why.

I would really appreciate your help.

Hi @FBaumstark,

Ensure your custom code correctly updates the ticket description by, verify you’re using the correct property ID for the ticket description.
Include code to overwrite the description:
ticket.properties[‘hs_ticket_description’] = formattedDescription;
Ensure the custom code runs after the ticket is created.
If it’s still not working, check for API errors or add debug logs to troubleshoot.

I hope it helps, let me know if you need to talk!

Khushboo Pokhriyal

Growth & Operations

GroRapid Labs

LinkedIn | 9315044754 | Email | Website


@KhushbooP11njmc wrote:

Hi @FBaumstark,

Ensure your custom code correctly updates the ticket description by, verify you’re using the correct property ID for the ticket description.
Include code to overwrite the description:
ticket.properties[‘hs_ticket_description’] = formattedDescription;
Ensure the custom code runs after the ticket is created.
If it’s still not working, check for API errors or add debug logs to troubleshoot.

I hope it helps, let me know if you need to talk!

Khushboo Pokhriyal

Growth & Operations

GroRapid Labs

LinkedIn | 9315044754 | Email | Website


Hi everyone,

Thanks for the insights! I’ve checked the property ID and ensured that the custom code runs after ticket creation. I added the line ticket.properties[‘hs_ticket_description’] = formattedDescription; as suggested.

If the description still isn’t updating, I’ll look into API errors and add debug logs for further troubleshooting.

I appreciate all your help!

Hi @FBaumstark,

It looks like your code is almost correct, but the issue might be in how you’re trying to overwrite the ticket description. Here are a few things to check:

  1. Ensure the ticket is actually being updated: After formatting the content, make sure you’re correctly updating the ticket description field. The callback you’ve set up may not be directly overwriting the description.
  2. Check the update step: Double-check that the workflow is correctly targeting the ticket description property and that you’re using the right method or API to update the ticket in HubSpot.

You might need to explicitly call HubSpot’s API to update the ticket with the formatted content after processing it.

Best regard!

Hey community, thanks for the feedback.
With help of the developer docs I was able to solve the problem.
The code is correct and works. Unfortunately, the code itself could not update the property. So as @himanshurauthan said, the callback could not overwrite the description directly. The formatted description was only cached in the data output, which required another step in the workflow (copy property value) to overwrite the ticket description with the new formatted version.