0

I have a wire function where i am getting data from apex

get userAddressBookData() {
    var selectedUserListBeforeApexCall = this.selectedAddressList;
    console.log('selectedUserListBeforeApexCall---', JSON.stringify(selectedUserListBeforeApexCall))
    for (var i = 0; i < this.selectedAddressList.length; i++) {
        let selectedShippingMethodId = this.selectedAddressList[i].selectedShippingMethodId;
        let selectedShippingMethod = this.shippingMethodListData.find(
            shippingmethod => shippingmethod.Id === selectedShippingMethodId
        );
        console.log('selectedShippingMethod---', JSON.stringify(selectedShippingMethod))
        if (selectedShippingMethod && selectedShippingMethod.ApprovalRequired__c) {
            // let approvalRequired  = this.selectedAddressList[i].isApprovalRequiredForShippingMethod;
            // approvalRequired = true;
            // console.log('here in')
            // this.selectedAddressList[i].isApprovalRequiredForShippingMethod = approvalRequired;
            // console.log('this.selectedAddressList[i].isApprovalRequiredForShippingMethod---',JSON.stringify(this.selectedAddressList[i].isApprovalRequiredForShippingMethod))

            this.selectedAddressList[i] = {
                ...this.selectedAddressList[i], // Spread operator to copy the existing object
                isApprovalRequiredForShippingMethod: true // Update the specific property
            };

        }
    }
}

based on some condition I am getting data but I am unable to update it it says uncaught in promise

please somebody help me as I am new to LWC this is the HTML code

 <template if:true={selectedList.isApprovalRequiredForShippingMethod}>
     <b style="color: #d12424;font-size:12px">The selected shipping method
 requires approval. This order will be submitted for shipping method approval.</b>
 </template>

this is the main template

<template for:each={selectedAddressList} for:item="selectedList">

this is the JSON data

[
    {
        "isApprovalRequiredForShippingMethod": false,
        "isCheckboxClicked": true,
        "quantity": 0,
        "selectedAddress": {
            "Id": "a08DF00000GZqVeYAL",
            "Name": "AB-00000",
            "City__c": "Travenieer",
            "Destination_Name__c": "ALex-Travenieer",
            "Shipto_Company__c": "Folio",
            "Shipto_Name__c": "ALex",
            "State__c": "a05DF000007R2kYYAS",
            "Address__c": "221b Bakers Street",
            "Active__c": true,
            "State__r": {
                "State_Name__c": "Florida",
                "Country__c": "a04DF00000DyUUyYAN",
                "Id": "a05DF000007R2kYYAS",
                "Country__r": {
                    "Country_Code__c": "US",
                    "Country_Name__c": "United States",
                    "Id": "a04DF00000DyUUyYAN"
                }
            }
        },
        "selectedShippingMethod": {},
        "selectedShippingMethodId": "a06DF00000FkZOUYA3"
    },
    {
        "isApprovalRequiredForShippingMethod": false,
        "isCheckboxClicked": true,
        "quantity": 0,
        "selectedAddress": {
            "Id": "a08DF00000GZt3eYAD",
            "Name": "AB-00001",
            "City__c": "Culver City",
            "Destination_Name__c": "Jonathan Boulangeat-Culver City",
            "Shipto_Company__c": "Folio Fine Wine Company",
            "Shipto_Name__c": "Jonathan Boulangeat",
            "State__c": "a05DF000007R2kYYAS",
            "Address__c": "5632 Canterbury Drive",
            "Active__c": true,
            "State__r": {
                "State_Name__c": "Florida",
                "Country__c": "a04DF00000DyUUyYAN",
                "Id": "a05DF000007R2kYYAS",
                "Country__r": {
                    "Country_Code__c": "US",
                    "Country_Name__c": "United States",
                    "Id": "a04DF00000DyUUyYAN"
                }
            }
        },
        "selectedShippingMethod": {},
        "selectedShippingMethodId": "a06DF00000FkZOUYA3"
    }
]
1
  • How is this getter ->userAddressBookData utilized? Commented 8 hours ago

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.