Update Deal Properties in JS Code

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

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

--

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 …

Hi @CClokeBrowne, I hope that you are well!
Thank you for reaching out to the Community!
I found a similar post “SimplePublicObjectInput Not Found” with a solution from @ph_alti_trading that might help you!
There is also the post from @jcummings2 on this similar post “v3 Deals update returns no properties found to update” 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 :slightly_smiling_face:
Thanks a lot and have a brilliant day!
Best,
Bérangère