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.
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
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
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 !