Update UI only field in Aggregated Table ?

  • 1
  • Question
  • Updated 1 year ago
  • Answered
  • (Edited)
I have a Aggregated model and UI only field in that aggregated model. I am trying to update the UI field on page load but it doesn't get updated ?
Below is the sample code:
$.each( modelUI.getRows(), function(){
            rowsToUpdate[this.quoterSBQQAccountrId] = { TotalAllocatedField: 22};
        });
Since, this is aggregate table i am using Aliasname for [this.Id]
In console, i can see the the field is updated in Console but it doesn't get reflected on the table ?

CONSOLE

TABLE
Photo of ace

ace

  • 580 Points 500 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
You could go declarative with this:

On page load you can set the UI Only Field value to be whatever you want. It's slick, simple, and supported when you go to upgrade in the future. 

No code required

Any reason why you're wanting to use code? Any particular use case here?
Photo of ace

ace

  • 580 Points 500 badge 2x thumb
Actually, i am fetching the value from Salesforce(Apex) in JSON format. I need to populate these value in the UI field in aggregated model. I can see these value in console but doesn't get updated  in model ?
Below is the part of the code, 

var result = sforce.apex.execute('TotalAllocatedBadges','TotalAllocatedBadges', {acctL:JSONString,eventId:eID});
console.log(result);
var acctList = JSON.parse(result);
console.log(acctList);
var rowsToUpdate = {};
var modelEB = skuid.model.getModel('ExpocadBadgeAgg');
if (acctList)
{
   $.each(acctList, function( index,value) {
       rowsToUpdate[value.acctId] ={TotalAllocatedField: value.totalAllocatedBadges};
   });
   modelEB.updateRows( rowsToUpdate );   
}    
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
In that case I would switch the Content to "Field from another model" and bring in the information you're looking for in a regular model. If you've already got the code for a regular model to bring in the Salesforce Apex in JSON format to a regular model.