Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Java
  3. Question
Java

I am facing an error using javascript remoting Salesforce, what should I do?

Asked by Amit Jaisawal Oct 10, 2022 785 views 1 answer
Share

About this question

I am trying to call a custom apex controller from javascript code in my visual force page but keep getting the following error :

 Visualforce Remoting Exception: No such column '_name' on sobject of type facture__c 
Here's the javascript call :
   var createFacture = function() {
          var facture = new Object Model.Facture();
          var factureReferenceField = document.getElementById('facture-reference');
          var factureClientField = document.getElementById('select-client');
          facture.Reference__c = factureReferenceField.value ;
          facture.Client _c = facture Client Field.value;
          console.log(facture);
        Visualforce.remoting.Manager.invokeAction(
            //Invoking controller action getcon
            '{!$RemoteAction.TestController.saveFacture}',
             facture, facture Lines,
            function(result, event){
                console.log("in callback func");   
                console.log(event.status);
                console.log(event.message);
            },
            {escape: true}
        );
         console.log('hell yeah');                          
      }

and here's the apex controller method Im trying to call :

@RemoteAction

public static Facture _c save Facture(Facture _c facturé, Ligne _c[] lines) {
    // Perform isUpdateable() checking first, then
    System.debug('facture: '+ facture);
    System.debug('lines: '+ lines);
    upsert facture;
    for(Ligne__c line : lines) {
        line.facture _c = facture.Id;
        upsert line;
    }
    return facture;
}

I ve made the full code of the page and the controller available on github if you need to see more : How to fix this error and make my remote call work?

Your answer

1 Answer

More Java discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Java Blogs

Guides, tips and career advice on Java from JanBask experts.