Skip to main content
deleted 46 characters in body; edited tags
Source Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

I am trying to pass a Case SObject to apex class as parameter, but is not working. I did not see the System.debug on the console. Why?

//wire the record
  @wire(getRecord, { recordId: '$recordId', fields })
  case;

  setCaseStatus({
        objCase: this.case // also tried this.case.data
    })
    .then(() => {
        console.log('sucess! ');
    })
    .catch((error) => {
        console.log('Error received: code' + error.errorCode + ', ' +
        'message ' + error.body.message);

    });

//Apex class method
 @AuraEnabled(cacheable=true)
    public static void setCaseStatus(Case objCase){
       System.debug('CaseService.setCaseStatus.case: ' + objCase);
      
       objCase.status = 'Working';
       update objCase;
    }

I did not see the System.debug on the console.

Another question is: Is it possible apex void method in lwc?

Anyone can help with those questions?

Thanks

I am trying to pass a Case SObject to apex class as parameter, but is not working.

//wire the record
  @wire(getRecord, { recordId: '$recordId', fields })
  case;

  setCaseStatus({
        objCase: this.case // also tried this.case.data
    })
    .then(() => {
        console.log('sucess! ');
    })
    .catch((error) => {
        console.log('Error received: code' + error.errorCode + ', ' +
        'message ' + error.body.message);

    });

//Apex class method
 @AuraEnabled(cacheable=true)
    public static void setCaseStatus(Case objCase){
       System.debug('CaseService.setCaseStatus.case: ' + objCase);
      
       objCase.status = 'Working';
       update objCase;
    }

I did not see the System.debug on the console.

Another question is it possible apex void method in lwc?

Anyone can help with those questions?

Thanks

I am trying to pass a Case SObject to apex class as parameter, but is not working. I did not see the System.debug on the console. Why?

//wire the record
  @wire(getRecord, { recordId: '$recordId', fields })
  case;

  setCaseStatus({
        objCase: this.case // also tried this.case.data
    })
    .then(() => {
        console.log('sucess! ');
    })
    .catch((error) => {
        console.log('Error received: code' + error.errorCode + ', ' +
        'message ' + error.body.message);

    });

//Apex class method
 @AuraEnabled(cacheable=true)
    public static void setCaseStatus(Case objCase){
       System.debug('CaseService.setCaseStatus.case: ' + objCase);
      
       objCase.status = 'Working';
       update objCase;
    }

Another question: Is it possible apex void method in lwc?

Post Closed as "Needs more focus" by glls, itsmebasti, Pranay Jaiswal, battery.cord, Mohith Shrivastava
Source Link

Salesforce LWC - Pass standard object to Apex Class

I am trying to pass a Case SObject to apex class as parameter, but is not working.

//wire the record
  @wire(getRecord, { recordId: '$recordId', fields })
  case;

  setCaseStatus({
        objCase: this.case // also tried this.case.data
    })
    .then(() => {
        console.log('sucess! ');
    })
    .catch((error) => {
        console.log('Error received: code' + error.errorCode + ', ' +
        'message ' + error.body.message);

    });

//Apex class method
 @AuraEnabled(cacheable=true)
    public static void setCaseStatus(Case objCase){
       System.debug('CaseService.setCaseStatus.case: ' + objCase);
      
       objCase.status = 'Working';
       update objCase;
    }

I did not see the System.debug on the console.

Another question is it possible apex void method in lwc?

Anyone can help with those questions?

Thanks