I encountered an issue, as I want to access a property of an object I'm passing from a lwc to an apex method, like this:

valuesObj.ml_id = this.sfItem.id;
this.itemObj = valuesObj;

and then:

processItemEdit( {item : this.itemObj} ).then(r => {
     console.log('r', r);

This is the apex method:

public static void processItemEdit(CsvItem item){
    List<CsvItem> items = new List<CsvItem>();
    String seller_id = String.valueOf(item.ml_id);
    Seller_Setting__c setting = SellerSettingDataManager.getSetting(seller_id);
    setting = BatchApexListItems.getSetting(setting.id);
    BatchApexListItems.processItemsCsv(items, setting);

For some reason, apex throws an error when I try to deploy, saying the variable 'item.ml_id' does not exist, when it is defined in the first line of code I included here. What is going on?

  • 1
    Can you share CsvItem apex class also? Commented Feb 10, 2021 at 17:01
  • 1
    oohh I understand the problem. If that class doesn't have that property, apex won't find it. The object I created in the component does have the property but when converted to CsvItem, it doesn' translate, right? Commented Feb 10, 2021 at 17:23
  • Yes. You have got it right.
    – Naga
    Commented Feb 10, 2021 at 21:40

1 Answer 1


As I see you have just created the object CsvItem on the client side. But when the object is passed to server side, i.e. Apex, you need same properties in Apex class defined as 'CsvItem'

For eg:

public class CsvItem{

    public String ml_id {get ; set; }
  • that was the problem. Anyway, I solved it by passing the right properties directly from the lwc. thanks for the help Commented Feb 11, 2021 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .