How to Add Fields to Custom Modules via HubSpot’s FTP

Using HubSpot’s FTP is really handy when you want to add new fields to an old custom module, or want to transfer fields between custom modules. It can save a lot of manual and repetitive field setup time, as well as prevent errors if you want identical fields between modules.

The purpose of this instruction is to show users how to add fields via FTP because it is not exactly straight forward. I have had issues with using HubSpot’s FTP on Codeanywhere and only use FileZilla to transfer fields via FTP.

In order to support the new Crankshaft framework, I am going to show you how to add the advanced features in detail using FileZilla. For those unfamiliar with the CrankShaft project, check out the Github repo here.

Prerequisites:

1. Basic knowledge of JSON

2. FileZilla installed (other clients may work, but I have not tried them all)

3. HubSpot Design Manager 2 Modules (DM1 won’t work!)

Step 1Identify the custom module fields you want, and find them in your module via FTP

Get your fields.json data that you want to add to your module. These JSON objects store the data that produces fields in HubSpot’s design manager.

In this example, you can use the “Advanced Features Module” fields.json file in the CrankShaft Github repo. It is a JSON file with field data. If you’re going this route, copy that JSON data.

If you are copying your own fields, here’s how to get them:

Connect to your HubSpot account via FTP using FileZilla. Instructions for how to do this are here.

Once you’re connected to the server, find your module in the account portal that houses it. Navigate to your module in the file directory, and you will see a list of files in it.

Right Click “fields.json” and click “view/edit.”

filezilla screenshot.png

Your default text editor will open the fields.json file.

Copy the desired field JSON like the image below. In this case I am copying ALL of them.

Screen Shot 2018-10-29 at 3.48.10 PM.png

Notice where the open/closing bracket and curly brace begin and end, and note commas between them. This is where the basic understanding of JSON comes in ;).

The fields are labeled with the same name in the Design Manager so it’s clear which are which.

Step 2. Paste JSON into different module

Find the module that you want to add the fields to. Open up the “fields.json” file in your new module the same way you did with the first module.

Add a comma after a curly brace where you want to insert your fields. Paste your new fields in. It can help to collapse your code in the editor to make sure it’s copying and pasting in the right spot. Note where fields are nested within each other.

Where you paste the code depends on your application.

Step 3 – Delete the IDs for your pasted-in fields.

According to HubSpot developer Anthony Pizzuro, it is a good idea to clear the HubSpot IDs for the fields you are pasting in. This ID is generated automatically, and could conflict with the original module’s ID if they are on the same page.

delete ids.png

Step 4 - Upload to the HubSpot server

Once you have your new fields pasted in, save your modified file in your text editor. FileZilla will pop up a notification about sending the modified file to the server.

Select Yes.

upload file.png

That’s it!

The file will upload to the server if everything worked. You should be able to refresh your module in Design Manager 2, and the new fields will show up.

success.png

And here they show up in Design Manager 2. Magical!

 Before

Before

 After!

After!

Troubleshooting:

If it doesn’t work, you may have pasted the JSON in incorrectly. Check for syntax errors and try again.

If you doubt whether the server will accept changes, make a small tweak to the module (like slightly changing the help text in an existing module) to see if it will work. Then you will know your FTP is working properly.

Bottom Line

This really is just glorified copy and pasting. However, this took me a couple tries to get a process working so if it doesn’t work send me a message on the HubSpot Slack or ask a HS dev. The other bottom line is this absolutely works so there’s no need to wonder if it’s worth trying.

As you can see from the before and after, you can paste in as many fields as you want at once. This method can save you a boatload of time and I hope it does!