We have a junction object called OpportunityAccounts that is a many-to-many relationship between an Account and Opportunity. We have a table of these objects that includes a custom mass action snippet, that I’m using to update a field called “PrimaryAddress__c” on the Account.
However, can’t figure out save my Account objects with the OpportunityAccountModel:
var addressId = getAddressId();<br />var selectedItems = argumentsa0].list.getSelectedItems();<br />var model = argumentsa0].model;<br />var rowsToUpdate = {};<br />selectedItems.map(function(item) {<br /> rowsToUpdatesitem.row.Account__c] = { PrimaryAddress__c: addressId };<br />});<br />model.updateRows(rowsToUpdate);<br />model.save();
After saving the model, the accounts are not updated. I’m guessing this is because the model is referencing the junction object (OpportunityAccount).
So what do I need to do to update these records? I tried initializing a new model as well as creating a dummy one through the UI. Neither option worked for me.
Kinda at a loss for what else to try, anyone have a solution?