2

In my Lightning component a list of Custom Object records are fetched and being displayed on the component. After editing some of the records and sending back the same list to the Update function in apex controller. The call is not getting initiated. It is throwing some error "Unable to read sObject" in the browser console.

The type of return value in first function to get records, type of attribute in component, and the type of parameter in Apex update function are all the same (custom object). Name-space also is added as required.

The same code was working perfectly before Spring '16 release. Any thoughts are welcome.

  • 2
    You may want to post the relevant code snippet. – Santanu Halder Feb 24 '16 at 6:50
  • There are ongoing security improvements to the JS in lightning components. Particularly if you are using any non-aura events in your code. There is a note about it in the Spring 16 release notes. Things aren't supposed to break in this release, but maybe something is not right: releasenotes.docs.salesforce.com/en-us/spring16/release-notes/… – pchittum Feb 24 '16 at 15:56
1

I've hit this and in my case it was a combination of Visualforce and the sobject containing populated lookup/master detail fields. I was able to fix it by adding the sobjectType attribute to my sobject before I sent it back. Here's the example from my situation around sending an account back:

sendToServer : function(cmp, ev) {
    var action=cmp.get('c.SendAccount');
    var acc=cmp.get('v.acc');

    // set the sobjectType!
    acc.sobjectType='Account';

    action.setParams({'acc' : acc});
    var self=this;
    action.setCallback(this, function(response) {
            self.actionResponseHandler(response, cmp, self, self.sentAccount);
    });
    $A.enqueueAction(action);
}

Here's the link to the full details of my issue : Lightning Components in Visualforce - Unable to read sobject

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.