How to use Toolbox Javascript’s plugin to change nested object’s data

i’ve been stuck for over a month

i am using toolbox’s javascript to bubble plugin in the workflow. Trying to do some client side changes and not touch the database until “save” is hit.

i am make an accounting program. My database is set up like this;

Transactions

  • Date (date)
  • Vendor Name (text)
  • Description (text)
  • Transaction Number (number)
  • Entries
    - Amount (Number)
    - Credit/Debit (option set)
    - Status (option set)
    - Invoice Number
    - Transaction Number (number)
    - Account
    - Account Name (text)
    - Account Type (option set)
    - Account Number (number)

I have a table showing a list of “Transactions” from the database, the user selects a transaction and a popup opens with the details of that transaction such as date, vendor and a list of “Entries” for that transaction. Entires categorize the transaction into as many “Accounts”.

ex: a $100 Transaction at the Grocery Store can be categorized with 2 “Entries” : $40 “business expense” account, $60 “advertising expense” account”

I have a table that lists the transactions from the database. The user selects it and a popup opens detailing that Transaction’s details along with a table showing it’s “Entries”.

I’d like the user be able to change the “Account” or “Amount” of an Entry without making changes to the database. the user can also add or delete an Entry. All of the changes are tracked using a custom state. When the user click “Save” then the custom state’s info is saved.

i want to avoid using bubble’s “minus item” or “plus item” because it has issues with duplicate values.

so i am using toolbox’s javascript in the workflow. i am trying to pass a custom state list Entries as paramlist1 and return a list of Entries but with Entry[selectedindex].Account changed to Dropdown Account’s value.

i cant even do Entry[0]. Amount = 40;

I see the changed array values in console.log but when i return the array to bubble, and i show Test_Entry’s value list’s each item’s Amount it still shows as the original amount.

How can I change the value of an Object’s nested data? Do I need to write a custom plugin? or play with json which I am not familiar with.