Skip to main content
added 4 characters in body
Source Link
sfdcfox
  • 501.6k
  • 21
  • 473
  • 828

The callApex code called from the Lightning Controller to Apex is synchronous. I think your misunderstanding comes from the idea that you need to perform a callout asynchronously. This is not true. The only time you need to perform a callout asynchronously is if you've already started or completed at least one DML operation in the current transaction. This means that callouts performed from triggers must always be asynchronous. The rest of the time, such as in Visualforce or Lightning controllers, you do not need to perform a callout asynchronously as long as you do not violate the DML-before-callout rule.

The call from the Lightning Controller to Apex is synchronous. I think your misunderstanding comes from the idea that you need to perform a callout asynchronously. This is not true. The only time you need to perform a callout asynchronously is if you've already started or completed at least one DML operation in the current transaction. This means that callouts performed from triggers must always be asynchronous. The rest of the time, such as in Visualforce or Lightning controllers, you do not need to perform a callout asynchronously as long as you do not violate the DML-before-callout rule.

The Apex code called from the Lightning Controller is synchronous. I think your misunderstanding comes from the idea that you need to perform a callout asynchronously. This is not true. The only time you need to perform a callout asynchronously is if you've already started or completed at least one DML operation in the current transaction. This means that callouts performed from triggers must always be asynchronous. The rest of the time, such as in Visualforce or Lightning controllers, you do not need to perform a callout asynchronously as long as you do not violate the DML-before-callout rule.

Source Link
sfdcfox
  • 501.6k
  • 21
  • 473
  • 828

The call from the Lightning Controller to Apex is synchronous. I think your misunderstanding comes from the idea that you need to perform a callout asynchronously. This is not true. The only time you need to perform a callout asynchronously is if you've already started or completed at least one DML operation in the current transaction. This means that callouts performed from triggers must always be asynchronous. The rest of the time, such as in Visualforce or Lightning controllers, you do not need to perform a callout asynchronously as long as you do not violate the DML-before-callout rule.