Skip to main content
2 of 3
added 530 characters in body
Ashwani
  • 22.7k
  • 4
  • 41
  • 73

You didn't define the defaults for Account sobject type:

It should be like that:

<aura:attribute 
                type="Account" 
                name="acc"
                default="{ 'sobjectType': 'Account',
                           'Name': '',
                           'Rating': 'Hot'
                         }"
 />

Your ControllerJS would be:

({
    init : function(cmp, event, helper) {
        console.log('init');
        var action = cmp.get('c.getAcc');
        action.setCallback(this, function(response) {
            var acc = response.getReturnValue();
            var accT = JSON.stringify(acc);
            accT = JSON.parse(accT);
            accT.Rating = 'Hot T';
            cmp.set('v.acc', accT);
        });
        $A.enqueueAction(action);
    }
})
Ashwani
  • 22.7k
  • 4
  • 41
  • 73