# Just learning and need some help! - Setting amount from total MRR

**URL:** <https://community.hubspot.com/t/just-learning-and-need-some-help-setting-amount-from-total-mrr/83699>\
**Category:** Data Hub\
**Created:** [June 19, 2023, 6:24pm UTC](https://community.hubspot.com/t/just-learning-and-need-some-help-setting-amount-from-total-mrr/83699 "2023-06-19T18:24:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RReiffer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rreiffer/32/232_2.png) [@RReiffer](https://community.hubspot.com/u/RReiffer)\
**Post date:** [June 19, 2023, 6:24pm UTC](https://community.hubspot.com/t/just-learning-and-need-some-help-setting-amount-from-total-mrr/83699/1 "2023-06-19T18:24:27Z")

</div>

Hello all,

I am trying to build the code that will do the following:

If the amount on the deal = 0 and there is total\_mrr \> 0 on any line item then update the amount with the total of all line items that have total\_mrr\>0 else do nothing.

---

<div class="post-metadata">

**Author:** ![kvlschaefer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kvlschaefer/32/71076_2.png) [@kvlschaefer](https://community.hubspot.com/u/kvlschaefer)\
**Post date:** [June 20, 2023, 12:22pm UTC](https://community.hubspot.com/t/just-learning-and-need-some-help-setting-amount-from-total-mrr/83699/2 "2023-06-20T12:22:36Z")

</div>

Hi @RReiffer,

Thanks for reaching out to the Community!

I wanted to invite our subject matter experts to this conversation.

Hi @Teun, @louischausse, @johnelmer - Do you have any programmable automation tips for @RReiffer ?

Thank you!

Best,

Kristen

---

<div class="post-metadata">

**Author:** ![RReiffer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rreiffer/32/232_2.png) [@RReiffer](https://community.hubspot.com/u/RReiffer)\
**Post date:** [June 20, 2023, 5:42pm UTC](https://community.hubspot.com/t/just-learning-and-need-some-help-setting-amount-from-total-mrr/83699/3 "2023-06-20T17:42:08Z")

</div>

I believe I have gotten fairly close. Please look at this post as I have most of my detail in there. It has my code and screen shots so you can see what I am attempting to do. Right now the code runs without error and even my values seem correct (commented console.log lines), however the actual fields in the deal doesn’t update.

[https://community.hubspot.com/t5/APIs-Integrations/Issue-with-my-code-not-writing-data-back-to-a-Deal-with-the/td-p/809755](https://community.hubspot.com/t5/APIs-Integrations/Issue-with-my-code-not-writing-data-back-to-a-Deal-with-the/td-p/809755)
