-2

I have an apex method which is returning Wrapper List.Some of the Wrapper Variables has values as null.Those null values and there variable names are not returning in LWC.

Wrapper Data:

[AccountNo  = 1012273872837,
ActualShipDate  = null,
AttName         = test,
AttNumber       = null,
City            = BANGALORE,
Country         = India,
EstimatedDate   = null]

I want to access ActualShipDate,AttNumber,EstimatedDate variables but unable to see them in my LWC even though in the Apex logs I can see the data is present.

I tried replacing the null values with empty strings but EstimatedDate is date type variable and it is throwing error from apex side.

Can anyone suggest any approach for?

1
  • 4
    Adding your apex controller code can help us give you a better answer. :)
    – NedlaV
    Jul 20, 2023 at 14:18

1 Answer 1

0

If I'm understanding this question right, then when you are calling your method in LWC js using wire then in result you will be having all data and if you want to assign it to some particular value in LWC then you can perform this action

@wire(method)
methodParam(result){
this.data = result.map( wrapper => {
this.shipDate = wrapper.ActualShipDate
});

that's how you can approach. Here, ActualShipDate is wrapper variable which you must be getting from your apex and shipDate is the variable defined in LWC. I Hope it helps. If not, more controller code would be helpful.

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