2

I'm trying to pass the data to Apex class from LWC, here is the code:

import getIPData from '@salesforce/apex/InvokeIPController.getIPData';
....
@api
invokeIPData() {

    let IPDetails = {
        Name : 'LWC_SampleData',
        inputMap : {},
        options : {}
    }

    getIPData(IPDetails)
            .then(result => {
                console.log(result);
                this.contacts = result;
                this.error = undefined;
            })
            .catch(error => {
                console.log(error);
                this.error = error;
                this.contacts = undefined;
            });
    return null;
}

In the Apex Class, I have :

public with sharing class InvokeIPController {

@AuraEnabled
public static Object getIPData(Map<String, Object> procedureDetails){
    System.debug('procedureName : ' + procedureDetails);
    ....
}

The procedureDetails is coming as null. May I know what am I missing here? I believe something wrong in the way I'm passing the data to Apex Class.

0
3

The parameters object is an object, not a list of parameters:

getIPData({ procedureDetails: IPDetails })

Note that procedureDetails is the case-sensitive name of the parameter name, and IPDetails is the case-sensitive name of the variable that contains the data. This is demonstrated in the trailhead module on Github.

    findContacts({ searchKey: this.searchKey })
        .then(result => {
            this.contacts = result;
            this.error = undefined;
        })
        .catch(error => {
            this.error = error;
            this.contacts = undefined;
        });
1
  • That worked like a charm..!! – Deepak Bandi Feb 28 '19 at 19:20

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.