---
title: Remove File Name IDs from Form File Uploads in HubSpot Using Workflows
description: Learn how to remove unwanted IDs from file names from form submissions in HubSpot using workflows to improve operational efficiency and file management.
image: https://www.whimpact.co/hubfs/2026-07-13_whinsight_thumbnail_Remove-File-Name-IDs-in-HubSpot-Using-Workflows.png
---

[Skip to content](https://www.whimpact.co/wh1nsights/remove-file-name-ids-from-form-file-uploads-in-hubspot-using-workflows#main-content)

[![whimpact logo](https://www.whimpact.co/hs-fs/hubfs/whimpact%20logo.png?width=333&height=250&name=whimpact%20logo.png)](https://www.whimpact.co)

- [About WHI](https://www.whimpact.co/about)
- [Learn - WHInsights](https://www.whimpact.co/wh1nsights)

Open main navigation

Close main navigation

- [About WHI](https://www.whimpact.co/about)
- [Learn - WHInsights](https://www.whimpact.co/wh1nsights)
- [Start Your Assessment](https://www.whimpact.co/whintensive)

[Start Your Assessment](https://www.whimpact.co/whintensive)

 Jul 13, 2026 2:26:52 PM

# Remove File Name IDs from Form File Uploads in HubSpot Using Workflows

![Picture of Ryan Schweighart](https://www.whimpact.co/hs-fs/hubfs/Chat_photo-1.jpg?width=50&name=Chat_photo-1.jpg) [Ryan Schweighart](https://www.whimpact.co/wh1nsights/author/ryan-schweighart)

Be a hero and share this WHInsight: [Share this page via Email](mailto:?body=https://www.whimpact.co/wh1nsights/remove-file-name-ids-from-form-file-uploads-in-hubspot-using-workflows) [facebook-f icon](http://www.facebook.com/share.php?u=https://www.whimpact.co/wh1nsights/remove-file-name-ids-from-form-file-uploads-in-hubspot-using-workflows) [Share this page on LinkedIn](http://www.linkedin.com/shareArticle?mini=true&url=https://www.whimpact.co/wh1nsights/remove-file-name-ids-from-form-file-uploads-in-hubspot-using-workflows) [Share this page on Twitter](https://twitter.com/intent/tweet?url=https://www.whimpact.co/wh1nsights/remove-file-name-ids-from-form-file-uploads-in-hubspot-using-workflows)

# How to Remove File Name IDs from Form File Uploads in HubSpot Using Workflows

This guide demonstrates how to streamline file uploads in HubSpot by removing unwanted IDs from file names from form submissions using a simple workflow. By integrating HubSpot's automation capabilities, you can enhance the efficiency of your customer service operations.

## Introduction

When you upload files through HubSpot forms, a unique ID is often added to the beginning of the file name. This can clutter your records and complicate file management. This tutorial will show you how to automate the removal of these IDs, ensuring cleaner and more professional file handling.

## Problem This Workflow Solves

The addition of random IDs to file names in HubSpot can lead to confusion and inefficiency in managing customer tickets and records. This workflow automates the renaming process, eliminating unnecessary clutter.

## Tools Required

- HubSpot
- HubSpot Workflows
- Custom Code (optional for advanced control)

## Workflow Summary

Upon form submission in HubSpot, a ticket is automatically created. This workflow intercepts the file upload process, removes unwanted ID prefixes from file names, and updates the ticket with the cleaned file name.

## Step-by-Step Guide

1. **Submit Form:** Start by submitting a form in HubSpot that includes a file upload.
2. **Create Ticket:** Ensure the form submission automatically creates a ticket in your help desk system.
3. **Access File:** Navigate to the newly created ticket to view the attached file with the unwanted ID.
4. **Set Up Workflow:** Create a HubSpot workflow that triggers when a ticket is created and includes a file upload.
5. **Custom Code Step:** Use HubSpot's custom code action to strip the unwanted ID from the file name. See code below.
6. **Update Ticket:** Save the changes, and the ticket will now display the cleaned file name.

```
 
```

Common Use Cases

- Improving file management for customer support tickets.
- Ensuring consistent naming conventions for uploaded files.
- Reducing administrative overhead by automating file renaming.

## Why This Improves Operations

By implementing this workflow, businesses can save time and reduce manual effort in managing customer tickets. It enhances client interactions by maintaining organized records and optimizes internal processes by eliminating redundant tasks.

For further questions or assistance, feel free to reach out. Bye for now.

## Code for Custom Code Step

```
const axios = require("axios");const FormData = require("form-data");exports.main = async (event, callback) => {  const token = process.env.accessToken;  const ticketId = event.inputFields["hs_object_id"];  const headers = {    Authorization: `Bearer ${token}`  };  try {    if (!ticketId) {      throw new Error("Missing hs_object_id.");    }    const noteIds = await getAssociatedNoteIds(ticketId, headers);    if (!noteIds.length) {      return callback({        outputFields: {          success: true,          message: "No associated notes found.",          notesChecked: 0,          filesCleaned: 0        }      });    }    const notes = await batchReadNotes(noteIds, headers);    let filesChecked = 0;    let filesCleaned = 0;    let notesUpdated = 0;    const cleanedFileMappings = [];    for (const note of notes) {      const noteId = note.id;      const attachmentValue = note.properties?.hs_attachment_ids;      if (!attachmentValue) continue;      const originalAttachmentIds = extractFileIds(attachmentValue);      const updatedAttachmentIds = [];      let noteChanged = false;      for (const fileId of originalAttachmentIds) {        filesChecked++;        const fileMeta = await getFileMeta(fileId, headers);        const currentName = buildFileName(fileMeta.data, fileId);        const cleanedName = cleanHubSpotFormFilename(currentName);        if (cleanedName === currentName) {          updatedAttachmentIds.push(fileId);          continue;        }        const newFileId = await copyFileWithCleanName(          fileId,          cleanedName,          headers        );        updatedAttachmentIds.push(newFileId);        noteChanged = true;        filesCleaned++;        cleanedFileMappings.push(`${fileId} -> ${newFileId}`);      }      if (noteChanged) {        await updateNoteAttachments(noteId, updatedAttachmentIds, headers);        notesUpdated++;      }    }    callback({      outputFields: {        success: true,        message: "Attachment cleanup complete.",        notesChecked: notes.length,        notesUpdated,        filesChecked,        filesCleaned,        cleanedFileMappings: cleanedFileMappings.join("; ")      }    });  } catch (error) {    callback({      outputFields: {        success: false,        message:          error.response?.data?.message ||          JSON.stringify(error.response?.data) ||          error.message      }    });  }};async function getAssociatedNoteIds(ticketId, headers) {  const noteIds = [];  let after;  do {    const url = new URL(      `https://api.hubapi.com/crm/v4/objects/tickets/${ticketId}/associations/notes`    );    url.searchParams.set("limit", "500");    if (after) url.searchParams.set("after", after);    const res = await axios.get(url.toString(), { headers });    for (const result of res.data.results || []) {      if (result.toObjectId) {        noteIds.push(String(result.toObjectId));      }    }    after = res.data.paging?.next?.after;  } while (after);  return [...new Set(noteIds)];}async function batchReadNotes(noteIds, headers) {  const notes = [];  for (let i = 0; i < noteIds.length; i += 100) {    const batch = noteIds.slice(i, i + 100);    const res = await axios.post(      "https://api.hubapi.com/crm/v3/objects/notes/batch/read",      {        properties: ["hs_attachment_ids"],        inputs: batch.map(id => ({ id }))      },      {        headers: {          ...headers,          "Content-Type": "application/json"        }      }    );    notes.push(...(res.data.results || []));  }  return notes;}async function getFileMeta(fileId, headers) {  return axios.get(`https://api.hubapi.com/files/v3/files/${fileId}`, {    headers  });}function buildFileName(fileData, fileId) {  const baseName =    fileData.name ||    fileData.path?.split("/").pop() ||    `file-${fileId}`;  const extension = fileData.extension    ? `.${String(fileData.extension).replace(/^\./, "")}`    : "";  if (extension && !baseName.toLowerCase().endsWith(extension.toLowerCase())) {    return `${baseName}${extension}`;  }  return baseName;}async function copyFileWithCleanName(fileId, cleanedName, headers) {  const signedUrlRes = await axios.get(    `https://api.hubapi.com/files/v3/files/${fileId}/signed-url`,    { headers }  );  const downloadRes = await axios.get(signedUrlRes.data.url, {    responseType: "arraybuffer"  });  const fileBuffer = Buffer.from(downloadRes.data);  const form = new FormData();  form.append("file", fileBuffer, cleanedName);  form.append("fileName", cleanedName);  form.append("folderPath", "/Cleaned Ticket Uploads");  form.append(    "options",    JSON.stringify({      access: "PRIVATE"    })  );  const uploadRes = await axios.post(    "https://api.hubapi.com/files/v3/files",    form,    {      headers: {        ...headers,        ...form.getHeaders()      }    }  );  return String(uploadRes.data.id);}async function updateNoteAttachments(noteId, fileIds, headers) {  return axios.patch(    `https://api.hubapi.com/crm/v3/objects/notes/${noteId}`,    {      properties: {        hs_attachment_ids: fileIds.join(";")      }    },    {      headers: {        ...headers,        "Content-Type": "application/json"      }    }  );}function extractFileIds(value) {  return String(value)    .split(/[;,\n]/)    .map(v => v.trim())    .filter(Boolean)    .map(v => {      const match = v.match(/(\d{6,})/);      return match ? match[1] : null;    })    .filter(Boolean);}function cleanHubSpotFormFilename(filename) {  return String(filename).replace(    /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}-[A-Z]+\.[^-]+-/i,    ""  );}
```

[Systemize Your Busyness](https://www.whimpact.co/wh1nsights/tag/systemize-your-busyness)

## Related posts

[![](https://www.whimpact.co/hs-fs/hubfs/2025.10.08_whinsight.png?height=200&name=2025.10.08_whinsight.png)](https://www.whimpact.co/wh1nsights/how-to-attach-a-file-to-a-hubspot-note-using-zapier)

[Systemize Your Busyness](https://www.whimpact.co/wh1nsights/tag/systemize-your-busyness)

## [How to Attach a File to a HubSpot Note Using Zapier](https://www.whimpact.co/wh1nsights/how-to-attach-a-file-to-a-hubspot-note-using-zapier)

![Picture of Ryan Schweighart](https://www.whimpact.co/hs-fs/hubfs/Chat_photo-1.jpg?width=50&name=Chat_photo-1.jpg) [Ryan Schweighart](https://www.whimpact.co/wh1nsights/author/ryan-schweighart) 

 Oct 8, 2025 6:14:41 PM

Have you ever wanted to create a note and attach a file in HubSpot using Zapier? In this week’s...

[Read more](https://www.whimpact.co/wh1nsights/how-to-attach-a-file-to-a-hubspot-note-using-zapier)

[![](https://www.whimpact.co/hs-fs/hubfs/DALL%C2%B7E%202023-12-13%2015.01.22%20-%20A%20sleek%2c%20modern%20desktop%20with%20a%20computer%20screen%20displaying%20a%20flowchart%20or%20diagram%20representing%20the%20automation%20process.%20Include%20symbols%20for%20a%20PDF%2c%20an%20em.png?height=200&name=DALL%C2%B7E%202023-12-13%2015.01.22%20-%20A%20sleek%2c%20modern%20desktop%20with%20a%20computer%20screen%20displaying%20a%20flowchart%20or%20diagram%20representing%20the%20automation%20process.%20Include%20symbols%20for%20a%20PDF%2c%20an%20em.png)](https://www.whimpact.co/wh1nsights/how-i-generated-a-pdf-from-a-microsoft-list-using-power-automate)

[Systemize Your Busyness](https://www.whimpact.co/wh1nsights/tag/systemize-your-busyness)

## [How I generated a PDF from a Microsoft List using Power Automate and Word](https://www.whimpact.co/wh1nsights/how-i-generated-a-pdf-from-a-microsoft-list-using-power-automate)

![Picture of Ryan Schweighart](https://www.whimpact.co/hs-fs/hubfs/Chat_photo-1.jpg?width=50&name=Chat_photo-1.jpg) [Ryan Schweighart](https://www.whimpact.co/wh1nsights/author/ryan-schweighart) 

 Dec 13, 2023 3:03:01 PM

Today's WH1nsight will demonstrate how I was able to generate a PDF from a Word document triggered...

[Read more](https://www.whimpact.co/wh1nsights/how-i-generated-a-pdf-from-a-microsoft-list-using-power-automate)

[![](https://www.whimpact.co/hs-fs/hubfs/2024.06.05%20whinsight%20thumbnail.png?height=200&name=2024.06.05%20whinsight%20thumbnail.png)](https://www.whimpact.co/wh1nsights/how-you-can-automatically-apply-association-labels-in-hubspot-using-zapier)

[Systemize Your Busyness](https://www.whimpact.co/wh1nsights/tag/systemize-your-busyness)

## [How You Can Automatically Apply Association Labels in HubSpot Using Zapier](https://www.whimpact.co/wh1nsights/how-you-can-automatically-apply-association-labels-in-hubspot-using-zapier)

![Picture of Ryan Schweighart](https://www.whimpact.co/hs-fs/hubfs/Chat_photo-1.jpg?width=50&name=Chat_photo-1.jpg) [Ryan Schweighart](https://www.whimpact.co/wh1nsights/author/ryan-schweighart) 

 Jun 5, 2024 11:33:53 AM

Hi, I'm Ryan Schweighart, founder of Whole Hart Impact, where I help businesses grow leveraging...

[Read more](https://www.whimpact.co/wh1nsights/how-you-can-automatically-apply-association-labels-in-hubspot-using-zapier)

---

[![Whole Hart Impact Logo 43-2](https://www.whimpact.co/hs-fs/hubfs/Whole%20Hart%20Impact%20Logo%2043-2.png?width=266&height=200&name=Whole%20Hart%20Impact%20Logo%2043-2.png "Whole Hart Impact Logo 43-2")](https://www.whimpact.co)

[![SolutionPartnerTierBadges_FINAL_PARTNER_ORANGE](https://www.whimpact.co/hs-fs/hubfs/SolutionPartnerTierBadges_FINAL_PARTNER_ORANGE.png?width=200&height=200&name=SolutionPartnerTierBadges_FINAL_PARTNER_ORANGE.png "SolutionPartnerTierBadges_FINAL_PARTNER_ORANGE")](https://app.hubspot.com/marketplace/20619232/solutions/whole-hart-impact)

[![hubspot community champions logo](https://www.whimpact.co/hs-fs/hubfs/logos/hubspot%20community%20champions%20logo.png?width=170&height=170&name=hubspot%20community%20champions%20logo.png "hubspot community champions logo")](https://community.hubspot.com/u/rschweighart/summary)

- [About WHI](https://www.whimpact.co/about)
- [Get $500, Give $1,000 - WHIntroductions](https://www.whimpact.co/whintroductions)
- [Pricing - WHImplementation](https://www.whimpact.co/whimplementation)
- [Grow - WHIntensive](https://www.whimpact.co/whintensive)
- [Learn - WHInsights](https://www.whimpact.co/wh1nsights)
- [Careers - WHImpacters](https://www.whimpact.co/careers)

### I want to hear from you!

[ryan@whimpact.co](mailto:ryan@whimpact.co)

+1 (405) 972-6809

Located in Carlsbad, CA -- Available worldwide

---

Copyright © 2026, Whole Hart Impact

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Ryan Schweighart",
    "url" : "https://www.whimpact.co/wh1nsights/author/ryan-schweighart"
  },
  "dateModified" : "2026-07-13T19:31:06.831Z",
  "datePublished" : "2026-07-13T19:26:52.000Z",
  "headline" : "Remove File Name IDs from Form File Uploads in HubSpot Using Workflows",
  "image" : [ "https://www.whimpact.co/hubfs/2026-07-13_whinsight_thumbnail_Remove-File-Name-IDs-in-HubSpot-Using-Workflows.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://www.whimpact.co/wh1nsights/remove-file-name-ids-from-form-file-uploads-in-hubspot-using-workflows",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://www.whimpact.co/hubfs/Whole%20Hart%20Impact%20Logo%2043-1.png"
    },
    "name" : "Whole Hart Impact, LLC"
  }
}
```