APIs & Integrations

MeganReid
Participant

HELP! - Custom Coded Workflow Actions

Hi everyone! 

 

Hoping there's someone smarter than I, who can assist with this. Read my situation below:

 

We are college that uses HubSpot to assign new lead inquiries to one of three sales team members on a rotation. As of Jan 1, one sales member has gone to part-time which has created a need to update our new lead assignment workflows. We recently upgraded to Ops Hub to take advantage of scheduled workflows, and I went ahead and created several different triggered workflows in hopes of having them assign new leads on a set schedule. I have recently been informed that this isn't the best way to achieve what we're after, and that instead of several, different scheduled workflows, I should look at ONE workflow with custom coding.

 

Here is what our HubSpot Support Rep said: "You will have to use a custom-coded action that looks at the current date and time and then based on the parameters set within the custom code will have to label a custom property with which group they converted under and then use a branch to split between the different types of rotations."

 

So, here is the schedule I'm trying to achieve, can anyone help with the creation of this custom coding?

 

Monday to Thursday: 11:45 AM to 6:30 PM – Michael and Judy

Monday to Thursday 6:30 PM – 11:45 AM - All 3 Program Advisors

Friday from 11:45 AM until Saturday 3:00 PM – Michael and Judy

Saturday 2:00 PM until Monday 11:45 AM - All 3 Program Advisors

 

Please help!

 

Megan

0 Upvotes
3 Replies 3
Jaycee_Lewis
Community Manager
Community Manager

HELP! - Custom Coded Workflow Actions

Hi, @MeganReid 👋 Thank you for your question and for including your requirements. 

 

If you are asking for the code to be created for you via the community, this likely isn't possible. While our community members are brilliant, creating custom code would likely fall under paid work. The peer-to-peer support our community provides is better suited to helping provide suggestions or looking at a specific issue in code you provide.

 

We'll leave this open in case a community member has a code example they can share as a starting point for your project.

 

Best,

Jaycee

 

 

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

Jaycee_Lewis
Community Manager
Community Manager

HELP! - Custom Coded Workflow Actions

Here's an overview you can share with a developer:

Overview for Developer

 

Objective: Automate the assignment of new lead inquiries to sales team members at a college using HubSpot. The assignment should follow a specific schedule that varies throughout the week, with one team member working part-time.

 

Requirements:

Ops Hub: The college has upgraded to HubSpot's Ops Hub, allowing for the use of custom-coded workflow actions.

 

Custom-Coded Workflow Action: A single workflow that includes a custom code action to determine the lead's assignment based on the current date and time.

 

Schedule for Lead Assignment:

Monday to Thursday:
11:45 AM to 6:30 PM – Assign to Michael and Judy
6:30 PM to 11:45 AM the next day – Assign to all 3 Program Advisors
Friday:
From 11:45 AM until Saturday at 3:00 PM – Assign to Michael and Judy
Saturday to Monday:
From 2:00 PM on Saturday until 11:45 AM on Monday – Assign to all 3 Program Advisors

 

Implementation Steps:

Custom Code Action in Workflow: Utilize a custom code action within a workflow to check the current date and time against the lead assignment schedule.
Determine Assignment Logic: Based on the current time and day, the code should decide which sales team member(s) the lead should be assigned to.
Update Contact Property: The script should update a custom contact property (e.g., assigned_team_member) on the lead's record in HubSpot with the determined assignment.
Workflow Branching: Use the updated contact property to branch the workflow, directing the lead to the appropriate team member(s) based on the assignment logic.

 

Technical Considerations:

The custom code can be written in JavaScript (Node.js) or Python, as supported by HubSpot.

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
MeganReid
Participant

HELP! - Custom Coded Workflow Actions

Hi Jaycee!

 

Thanks for your reply and helpful tips, much appreciated. At this point, I have resorted to ChatGPT to write the base of the code. Hopeful that someone in the community can check out what ChatGPT provided and suggest necessary edits, see below.

 

Thank you,

 

MeganCode Snippet 1.png

 

 

0 Upvotes