Getting Started

To configure your Portals integration, navigate to the configurations page and select an object type. On the right drawer, select the "Sync Logic Filter" button corresponding to the direction you want to filter records, either "To this group" or "From this group".



Doing so will prompt a modal to appear where you can add a filter.

AI and Plain-English Filters



Filters can be written in plain english from which our AI will generate the necessary code after clicking the "Convert" button. You can also write your own custom filter code. Clicking the "Validate" button will search your HubSpot account for records that pass and fail the filter so you can be sure the filter is working as expected.


Custom Code Filters

Custom code filters are written in JavaScript and must return a boolean value. The code is run in a Node.js environment and has access to the HubSpot record object, which is the record being evaluated. They must be written in the input field in a "code-block" form, that is, surrounded by ` back-ticks `. An example of custom code looks like this:

Custom Code Filter Example
(singleRecord) => {
  return (
    typeof singleRecord.properties.firstname === "string" &&
    singleRecord.properties.firstname === "Maria"
  );
};

For more details on the structure of the HubSpot Record object, see the HubSpot API Documentation.

Using the custom code, you can also access two "Magic Values" that are available to you:

  • [[SOURCE_PORTAL_ID]] - the ID of the source portal FROM which the record is being sent
  • [[TARGET_PORTAL_ID]] - the ID of the target portal TO which the record is being sent

for HubSpot deal objects, you also have access to the magic value:

  • [[PIPELINE_LABEL]] - the label of the pipeline the deal is in

Routing to Specific Portals

Using these magic values, you can route records to particular HubSpot portals in your integration by creating a custom code filter that looks like this:

Routing to Specific Portals
(record) => {
  return (
    typeof record.properties.portals_routing === "string" &&
    record.properties.portals_routing &&
    record.properties.portals_routing
      .split(";")
      .map((routing) => routing.trim())
      .some((routing) => routing === "[[TARGET_PORTAL_ID]]")
  );
};

or on the filter modal, this would look like:



Routing Deals based on Pipeline Label

For HubSpot Deal objects, you can condition your sync based on the pipeline label by creating a custom code filter that looks like this:

Routing Deals based on Pipeline Label
(record) => {  return "[[PIPELINE_LABEL]]" === "YOUR_PIPELINE_LABEL_HERE";};

In the filter modal, this would look like:

Note that you can also combine this with the previous routing to specific portals filter to route deals based on both the pipeline label and the target portal ID, like so:

Combining Filters with Routing
(record) => {  return (    "[[PIPELINE_LABEL]]" === "YOUR_PIPELINE_LABEL_HERE" &&    typeof record.properties.portals_routing === "string" &&    record.properties.portals_routing &&    record.properties.portals_routing      .split(";")      .map((routing) => routing.trim())      .some((routing) => routing === "[[TARGET_PORTAL_ID]]")  );};

FAQs

  • What happens if I add a portal that is not included in the sync logic routing rules?

    • This depends on the logic of the filter written. For instance you could specify that you want the property to be an exact match to the TARGET_PORTAL_ID and it will sync, or you could allow for Empty values or Exactly TARGET_PORTAL_ID which would look something like this:
Allow Empty or Exactly TARGET_PORTAL_ID

(record) => {
  return "[[PIPELINE_LABEL]]" === "YOUR_PIPELINE_LABEL_HERE";
};
  • Can I combine filters for a single target portal? For example a region value combined with a lead status filter point to target portal X?

    • Yes, you have to include that in the code and it would look like
Combining Filters with Routing
(record) => {  return (    record.properties.lead_status === "YOUR_LEAD_STATUS_HERE" &&    typeof record.properties.region === "string" &&    record.properties.region !== "" &&    record.properties.region      .split(";")      .map((region) => region.trim())      .some((region) => region === "[[TARGET_PORTAL_ID]]")  );};
  • Does this work with both custom code written and the plain language AI tool?

    • No, the plain-language tool may work but it also may not, we cannot guarantee that the AI will generate the proper filter and certainly at this time, the “Validation” part will not properly determine which records pass the filter
  • Can we key off of general associations? Ex. Contact is associated with a Deal?

    • Not at this time, though there is a way to trick the system into doing so. The backend code attempts to filter out bad records as soon as possible so as to minimize additional work done (like additional HubSpot calls and processing). Only once bad records have been filtered out does the “fetch associations” logic run so to filter on those associations would require an additional filter pass which does not currently happen but has been proposed.