# Update Deal Properties in JS Code

**URL:** <https://community.hubspot.com/t/update-deal-properties-in-js-code/100390>\
**Category:** APIs & Integrations\
**Tags:** object\
**Created:** [February 17, 2024, 12:29pm UTC](https://community.hubspot.com/t/update-deal-properties-in-js-code/100390 "2024-02-17T12:29:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CClokeBrowne](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cclokebrowne/32/201039_2.png) [@CClokeBrowne](https://community.hubspot.com/u/CClokeBrowne)\
**Post date:** [February 17, 2024, 12:29pm UTC](https://community.hubspot.com/t/update-deal-properties-in-js-code/100390/1 "2024-02-17T12:29:13Z")

</div>

Hello,

I have been coding for decades - but I have no experience of APIs - so please fogive the basic level of this …  
I have created some JS code that reads deal properties and calculates line item values based on them. It then creates these line items and associates them to the deal - all using hubspotClient.crm.lineItems.basicApi.create(LineInput);  
I am not trying to update the deal Amount and a bespoke deal property (TenInstalmentCost). I have produced the code below:  
\_\_

let dealAmtUpdate = ‘’;  
const tenPmtAmt = (TOTAL + 35.00)\*0.107000222;  
dealAmtUpdate = {  
“id”: event.object.objectId,  
“properties”: {  
“amount”: TOTAL,  
“TenInstalmentCost”: tenPmtAmt,  
},  
}

hubspotClient.crm.deals.basicApi.update(dealAmtUpdate);

\_\_  
The above code produces the error below. I am a bit lost as to what to do from here.  
\_\_  
2024-02-17T12:28:18.726Z ERROR Unhandled Promise Rejection {“errorType”:“Runtime.UnhandledPromiseRejection”,“errorMessage”:“RequiredError: Required parameter simplePublicObjectInput was null or undefined when calling BasicApi.update.”,“reason”:{“errorType”:“RequiredError”,“errorMessage”:“Required parameter simplePublicObjectInput was null or undefined when calling BasicApi.update.”,“api”:“BasicApi”,“method”:“update”,“field”:“simplePublicObjectInput”,“name”:“RequiredError”,“stack”:[“RequiredError: Required parameter simplePublicObjectInput was null or undefined when calling BasicApi.update.”," at BasicApiRequestFactory.\<anonymous\> (/opt/nodejs/node\_modules/@hubspot/api-client/lib/codegen/crm/deals/apis/BasicApi.js:153:23)“,” at Generator.next (\<anonymous\>)“,” at /opt/nodejs/node\_modules/@hubspot/api-client/lib/codegen/crm/deals/apis/BasicApi.js:8:71"," at new Promise (\<anonymous\>)“,” at \_\_awaiter (/opt/nodejs/node\_modules/@hubspot/api-client/lib/codegen/crm/deals/apis/BasicApi.js:4:12)“,” at BasicApiRequestFactory.update (/opt/nodejs/node\_modules/@hubspot/api-client/lib/codegen/crm/deals/apis/BasicApi.js:147:16)“,” at ObservableBasicApi.update (/opt/nodejs/node\_modules/@hubspot/api-client/lib/codegen/crm/deals/types/ObservableAPI.js:74:59)“,” at PromiseBasicApi.update (/opt/nodejs/node\_modules/@hubspot/api-client/lib/codegen/crm/deals/types/PromiseAPI.js:26:33)“,” at Object.exports.main (/var/task/file.js:198:34)“,” at Runtime.exports.hubspot\_handler [as handler] (/var/task/hubspotHandler.js:7:21)“]},“promise”:{},“stack”:[“Runtime.UnhandledPromiseRejection: RequiredError: Required parameter simplePublicObjectInput was null or undefined when calling BasicApi.update.”,” at process.\<anonymous\> (file:///var/runtime/index.mjs:1276:17)“,” at process.emit (node:events:513:28)“,” at emit (node:internal/process/promises:140:20)“,” at processPromiseRejections (node:internal/process/promises:274:27)“,” at processTicksAndRejections (node:internal/process/task\_queues:97:32)"]}  
Unknown application error occurred  
Runtime.Unknown

---

<div class="post-metadata">

**Author:** ![CClokeBrowne](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cclokebrowne/32/201039_2.png) [@CClokeBrowne](https://community.hubspot.com/u/CClokeBrowne)\
**Post date:** [February 17, 2024, 10:57am UTC](https://community.hubspot.com/t/update-deal-properties-in-js-code/100390/2 "2024-02-17T10:57:00Z")

</div>

Probably quite a basic question. I have programmed for decades - but I have no experience with APIs - so this is new to me …  
I have writted bespoke code on JS which calculates, creates and sets a number of line items in a deal - all good - using hubspotClient.crm.lineItems.basicApi.create(LineInput);  
I am no trying to calculate the Deal Amount and a bespoke variable (temPmtAmt) and update these using the code below:

--

let dealAmtUpdate = ‘’;  
const tenPmtAmt = (TOTAL + 35.00)\*0.107000222;  
dealAmtUpdate = {  
“id”: event.object.objectId,  
“properties”: {  
“amount”: TOTAL,  
“TenInstalmentCost”: tenPmtAmt,  
},  
}

hubspotClient.crm.deals.basicApi.update(dealAmtUpdate);

--

This generates the error below

--

```auto
2024-02-17T10:54:23.901Z	ERROR	Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"RequiredError: Required parameter simplePublicObjectInput was null or undefined when calling BasicApi.update.","reason":{"errorType":"RequiredError","errorMessage":"Required parameter simplePublicObjectInput was null or undefined when calling BasicApi.update.","api":"BasicApi","method":"update","field":"simplePublicObjectInput","name":"RequiredError","stack":["RequiredError: Required parameter simplePublicObjectInput was null or undefined when calling BasicApi.update."," at BasicApiRequestFactory.<anonymous> (/opt/nodejs/node_modules/@hubspot/api-client/lib/codegen/crm/deals/apis/BasicApi.js:153:23)"," at Generator.next (<anonymous>)"," at /opt/nodejs/node_modules/@hubspot/api-client/lib/codegen/crm/deals/apis/BasicApi.js:8:71"," at new Promise (<anonymous>)"," at __awaiter (/opt/nodejs/node_modules/@hubspot/api-client/lib/codegen/crm/deals/apis/BasicApi.js:4:12)"," at BasicApiRequestFactory.update (/opt/nodejs/node_modules/@hubspot/api-client/lib/codegen/crm/deals/apis/BasicApi.js:147:16)"," at ObservableBasicApi.update (/opt/nodejs/node_modules/@hubspot/api-client/lib/codegen/crm/deals/types/ObservableAPI.js:74:59)"," at PromiseBasicApi.update (/opt/nodejs/node_modules/@hubspot/api-client/lib/codegen/crm/deals/types/PromiseAPI.js:26:33)"," at Object.exports.main (/var/task/file.js:198:34)"," at Runtime.exports.hubspot_handler [as handler] (/var/task/hubspotHandler.js:7:21)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: RequiredError: Required parameter simplePublicObjectInput was null or undefined when calling BasicApi.update."," at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)"," at process.emit (node:events:513:28)"," at emit (node:internal/process/promises:140:20)"," at processPromiseRejections (node:internal/process/promises:274:27)"," at processTicksAndRejections (node:internal/process/task_queues:97:32)"]}
Unknown application error occurred
Runtime.Unknown

Memory: 78/128 MB
Runtime: 1926.78 ms

```

I am assuming that this is some kind of type mismatch in the data - please can someone help …

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [February 23, 2024, 12:12pm UTC](https://community.hubspot.com/t/update-deal-properties-in-js-code/100390/3 "2024-02-23T12:12:04Z")

</div>

Hi @CClokeBrowne, I hope that you are well!  
Thank you for reaching out to the Community!  
I found a similar post “[SimplePublicObjectInput Not Found](https://community.hubspot.com/t5/APIs-Integrations/SimplePublicObjectInput-Not-Found/m-p/536225)” with a solution from [@ph\_alti\_trading](https://community.hubspot.com/t5/user/viewprofilepage/user-id/137533) that might help you!  
There is also the post from @jcummings2 on this similar post “[v3 Deals update returns no properties found to update](https://community.hubspot.com/t5/APIs-Integrations/v3-Deals-update-returns-no-properties-found-to-update/m-p/383228)” that might be helpful.  
I’d like to ask our Top Experts to join this conversation: Hi @alyssamwilie, @stefen and @BarryGrennan do you have suggestions to help @CClokeBrowne, please?  
Also, if anybody else has anything to add and/or share, please feel free to join in the conversation 🙂  
Thanks a lot and have a brilliant day!  
Best,  
Bérangère
