function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mahesh GorrepatiMahesh Gorrepati 

LWC imperative call is not working properly

Hii EveryOne,
i have a apex class
public class class1{
     Public static list<string> method1(list<string> Param1){
          list<strings> messsages = new list<string> ();
           for(  String S : Param1){
              // Class2.method2(s)  will return a list  of strings
return  messsages;

I created  a LWC component in which above  method( class1.method1) is invoked IMperatively In javascript file
 in the .then block code after the promise is done is executing.
the returned list strings from the apex class is showd as a promise Object In console.

Kindly help here
AshwiniAshwini (Salesforce Developers) 
Hi Mahesh,

In LWC, when you are invoking an Apex method imperatively, it returns a promise which gets resolves when the server call completes. You have to  handle this promise correctly to access the response data.

Can you share your javascript code here?