Skip to main content

I want to create a list of Quotelineitems which will be passed from LWC to Apex Class. But i am not getting the Result. What is the Approach for that. This is the sample JSon which will be passed from lwc to apex. 

[

  {

    "PeId": "01u8b00000OiMK8AAN",

    "Product2Id": "01t8b000008JplZAAS",

    "Pricebook2Id": "01s0y0000009HUwAAM",

    "Product_Family": "CW/MHF",

    "quoteid": "0Q08B000000LsQeSAK",

    "Quantity": "5",

    "Optional__c": false,

    "ListPrice": "627751"

  },

  {

    "PeId": "01u8b00000OiMK7AAN",

    "Product2Id": "01t8b000008JpleAAC",

    "Pricebook2Id": "01s0y0000009HUwAAM",

    "Product_Family": "CW/MHF",

    "quoteid": "0Q08B000000LsQeSAK",

    "Quantity": "10",

    "Optional__c": false,

    "ListPrice": "627752"

  }

]

 

#Sales Cloud  #Salesforce Developer  #Automation

3 件の回答
  1. 2023年11月2日 19:42

    @Niket Uplenchwar

    Usually like below:

    1. Create an apex class with AuraEnabled method and String parameter like quoteLinesJson
    2. Create an wrapper in your apex class matching above data structure
    3. Pass your array to apex method using JSON.stringify(array)
    4. Deserialize to your wrapper in apex like List<Wrapper> quoteLinesEntries = (List<Wrapper>) JSON.deserialize(quouteLinesJson, List<Wrapper>.class)
    5. Create QuteLineItems objects and make a DML

    But send me some details where you are exactly stuck so we will identify the issue.

0/9000