I am calling method in js like

var = true;

The method is defined else where in js file like

//calling Apex Method

but the issue is the var = true gets executed before completion of myMethod(). How can i make sure that next line executes only after execution of called method ?

1 Answer 1


Apex methods are called asynchronously. You need to wait for them to finish if that's your intent:

async method1() {
  await this.myMethod();
  this.someVar = true;

async myMethod() {
  return myApexMethod({params})

You must log in to answer this question.

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