Skip to main content

Hello everyone! If I wanted to call a web service from a Lightning Record Page, where would I need to start? Ideally, I'd like to create a button/quick action that my users can click and it will launch the web service call. Any ideas are appreciated! Thanks in advance :)

1 comentário
  1. 5 de set. de 2018, 16:31
    You can create a Lightning component with the force:lightningQuickAction or force:lightningQuickActionWithoutHeader interface. Also create a CSP Trusted Site to whitelist your particular web service endpoint. https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/csp_trusted_sites.htm?search_text=csp

    You should then be able to call out from your Lightning component to your web service in your JavaScript code. You can add the Lightning component to your page as a Quick Action to be able to invoke it.

    Note that you cannot run externally hosted JavaScript inside of your Lightning component. This is prevented due to security vulnerabilities that this could make possible. An example of this would be running something like Google Maps directly in your Lightning component. To do something like this, you'd need to include a Visualforce page inside your Lightning component and use the externally hosted JavaScript inside the Visualforce page.

0/9000