CRM

NRevane7
Member

Prorated Amount Field

SOLVE

Hello Community!

 

I am reaching out to see if anyone has created or can help troubleshooting a field i am trying to create. We work a lot in proration, depending on when a tenant is moving in. Side Note: We do all of our contracts and billing outside of HubSpot and that wont change.  What i would like to do is create a calculation field that creates a prorated amount based on the deal amount, move-in date, and the amount of time left in the closing month. I have turned on the function to show the elapsed or future time for date fields, but that doesnt help when looking at the full month.

 

Thank you for your replies/help in advanced!

0 Upvotes
1 Accepted solution
karstenkoehler
Solution
Hall of Famer | Partner
Hall of Famer | Partner

Prorated Amount Field

SOLVE

Hi @NRevane7,

 

Generally, HubSpot allows for calculation using a dedicated property type: https://knowledge.hubspot.com/properties/create-calculation-properties

 

What you're describing does however seem to have a complexity that is too much for the fairly basic calculation formula builder. It sounds like this may have to be done with a custom code action (available in Operations Hub Professional and Enterprise) in a workflow: https://developers.hubspot.com/docs/reference/api/automation/custom-code-actions

 

Using Node.js and Python, you could perform any calculations you'd like.

 

Best regards!

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

View solution in original post

2 Replies 2
karstenkoehler
Solution
Hall of Famer | Partner
Hall of Famer | Partner

Prorated Amount Field

SOLVE

Hi @NRevane7,

 

Generally, HubSpot allows for calculation using a dedicated property type: https://knowledge.hubspot.com/properties/create-calculation-properties

 

What you're describing does however seem to have a complexity that is too much for the fairly basic calculation formula builder. It sounds like this may have to be done with a custom code action (available in Operations Hub Professional and Enterprise) in a workflow: https://developers.hubspot.com/docs/reference/api/automation/custom-code-actions

 

Using Node.js and Python, you could perform any calculations you'd like.

 

Best regards!

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

Jaycee_Lewis
Community Manager
Community Manager

Prorated Amount Field

SOLVE

Hey @NRevane7 👋 To add on to what Karsten shared, we can do this using vanilla JS:

function calculateProratedAmount(dealAmount, moveInDate) {
    const date = new Date(moveInDate);
    const moveInDay = date.getDate();
    
    const totalDaysInMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();

    const daysRemaining = totalDaysInMonth - moveInDay + 1; // Include the move-in day

    const proratedAmount = dealAmount * (daysRemaining / totalDaysInMonth);

    return proratedAmount;
}

Either by utilizing Custom Coded Workflow Actions or via webhooks and middleware you set up to handle this and use a similar workflow:

HubSpot → Webhook → Your Middleware → HubSpot API → Updated Deal

 

Have fun testing!  — Jaycee


HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes