SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { LightningElement, wire } from "lwc";
  2.  
  3. import getAccounts from "@salesforce/apex/MyCtrl.getAccounts";
  4.  
  5. export default class MyComponent extends LightningElement {
  6.  
  7.     @wire(getAccounts)
  8.     accounts = [];
  9. }
  10.      
  11. public with sharing class MyCtrl {
  12.  
  13.     @AuraEnabled(cacheable=true)
  14.     public static List<Account> getAccounts() {
  15.         try {
  16.             return getViaCallout();
  17.         }
  18.         catch(Exception ex) {
  19.             new ApplicationException().throwAuraHandled(ex);
  20.         }
  21.  
  22.         return null;
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top