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"
}
]
Usually like below:
- Create an apex class with AuraEnabled method and String parameter like quoteLinesJson
- Create an wrapper in your apex class matching above data structure
- Pass your array to apex method using JSON.stringify(array)
- Deserialize to your wrapper in apex like List<Wrapper> quoteLinesEntries = (List<Wrapper>) JSON.deserialize(quouteLinesJson, List<Wrapper>.class)
- Create QuteLineItems objects and make a DML
But send me some details where you are exactly stuck so we will identify the issue.