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})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.