APIs & Integrations

GrahamRobson
Member

Deal Amounts not being recalculated when Line Item Qty is updated via the API

SOLVE

Our context is a SaaS vendor where the deal amount can vary dynamically, we want Hubspot to automatically reflect the qty and value of deals on a per deal basis and to roll-up to reports. We want to base automation based on assessing the deal amount value.

 

We are using the Line Item API to dynamically change the Qty property of a Line Item on a deal, as driven from our internal systems when a customer increases the qty. Our Deal Amount configuration is set-up to nominate ARR as it's default method. Indeed, this works fine when the Hubspot UI is used to make changes to the qty.

 

However, when the API is used to update the qty, the Deal Amount is not recalculated. Indeed, the UI for editing the Line Item show it reverts to 'Manual' and thus the two get out of sync.

 

Deal Amount not being updated.png

 

We believe that the v3 API is being correctly used to update the qty, this is the response we get to making an update:

 

{"id":"750614934","properties":{"amount":"951.000","createdate":"2020-03-12T12:38:14.071Z","discount":"3","hs_acv":"11412.000","hs_arr":"11412.000","hs_created_by_user_id":"10620476","hs_lastmodifieddate":"2020-11-24T00:19:29.430Z","hs_margin":"951.000","hs_margin_acv":"11412.000","hs_margin_arr":"11412.000","hs_margin_mrr":"951.000","hs_margin_tcv":"11412.000","hs_mrr":"951.000","hs_object_id":"750614934","hs_tcv":"11412.000","hs_term_in_months":"12","hs_updated_by_user_id":"10620476","price":"6","quantity":"317","recurringbillingfrequency":"monthly"},"createdAt":"2020-03-12T12:38:14.071Z","updatedAt":"2020-11-24T00:19:29.430Z","archived":false}

Is this a bug, need to set something else when using the API, or another method like an automation used to provoke a Deal Amount recalculation?

 

Thanks,  Graham

 

 

2 Accepted solutions
lynton
Solution
Contributor | Elite Partner
Contributor | Elite Partner

Deal Amounts not being recalculated when Line Item Qty is updated via the API

SOLVE

Graham,

 

This appears to be either a bug or a limitation of the API. I suggest using the API to update the deal amount after updating any line items. 

View solution in original post

MichaelC
Solution
Guide | Partner
Guide | Partner

Deal Amounts not being recalculated when Line Item Qty is updated via the API

SOLVE

In php I solved this like follows:

 

$row_total can be part of an array - and is calculated by price x amount - discount.

 

if		($recurringbillingfrequency == 'monthly'){$deal_amount = $deal_amount + round($row_total * 12 * round($hs_term_in_month /12));}
elseif	($recurringbillingfrequency == 'quarterly'){$deal_amount = $deal_amount + round($row_total * 4 * round($hs_term_in_month /12));}
elseif	($recurringbillingfrequency == 'per_six_months'){$deal_amount = $deal_amount + round($row_total * 2 * round($hs_term_in_month /12));}
elseif	($recurringbillingfrequency == 'annually'){$deal_amount = $deal_amount + round($row_total * 1 * round($hs_term_in_month /12));}
elseif	($recurringbillingfrequency == 'per_two_years'){$deal_amount = $deal_amount + round($row_total * 0.5 * round($hs_term_in_month /12));}
elseif	($recurringbillingfrequency == 'per_three_years'){$deal_amount = $deal_amount + round($row_total * 0.33 * round($hs_term_in_month /12));}
elseif	(empty($recurringbillingfrequency)){$deal_amount = $deal_amount + round($row_total);}


Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

View solution in original post

5 Replies 5
MichaelC
Solution
Guide | Partner
Guide | Partner

Deal Amounts not being recalculated when Line Item Qty is updated via the API

SOLVE

In php I solved this like follows:

 

$row_total can be part of an array - and is calculated by price x amount - discount.

 

if		($recurringbillingfrequency == 'monthly'){$deal_amount = $deal_amount + round($row_total * 12 * round($hs_term_in_month /12));}
elseif	($recurringbillingfrequency == 'quarterly'){$deal_amount = $deal_amount + round($row_total * 4 * round($hs_term_in_month /12));}
elseif	($recurringbillingfrequency == 'per_six_months'){$deal_amount = $deal_amount + round($row_total * 2 * round($hs_term_in_month /12));}
elseif	($recurringbillingfrequency == 'annually'){$deal_amount = $deal_amount + round($row_total * 1 * round($hs_term_in_month /12));}
elseif	($recurringbillingfrequency == 'per_two_years'){$deal_amount = $deal_amount + round($row_total * 0.5 * round($hs_term_in_month /12));}
elseif	($recurringbillingfrequency == 'per_three_years'){$deal_amount = $deal_amount + round($row_total * 0.33 * round($hs_term_in_month /12));}
elseif	(empty($recurringbillingfrequency)){$deal_amount = $deal_amount + round($row_total);}


Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

GrahamRobson
Member

Deal Amounts not being recalculated when Line Item Qty is updated via the API

SOLVE

Thanks -  this gives me a good option.

lynton
Solution
Contributor | Elite Partner
Contributor | Elite Partner

Deal Amounts not being recalculated when Line Item Qty is updated via the API

SOLVE

Graham,

 

This appears to be either a bug or a limitation of the API. I suggest using the API to update the deal amount after updating any line items. 

GrahamRobson
Member

Deal Amounts not being recalculated when Line Item Qty is updated via the API

SOLVE

Thanks - I'll look to see how best to arrange our own ripple-up and also raise a ticket to see if it gets accepted as  a bug/enhancement, as I'd expect a consitent treatment from both the UI and API.

sharonlicari
Community Manager
Community Manager

Deal Amounts not being recalculated when Line Item Qty is updated via the API

SOLVE

Hey @GrahamRobson 

 

Thank you for reaching out! I'll mention a few experts that can share their knowledge with you!

 

Hey @malcolm1 @lynton any thoughts about this case?

 

Thank you 

Sharon


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




0 Upvotes