Gregory Rosenberg
Gregory Rosenberg

Reputation: 17

How to call an external Javascript function in a dynamic action?

I have a dynamic action set to trigger when a user presses a button. However I am well above the limit for the JavaScript I can put into the text box. I have uploaded my function as a .js file to the static file shared components part of the application.

However, I am at a loss as to how to now call that function when the dynamic action triggers. Also my JavaScript relies on form entries on the page it's being called from as it uses that data as variables.

How can I set the page to be able to call the function from the external .js file? Preferably in as step-by-step fashion as possible as I am still very new to Apex.

Upvotes: 0

Views: 1695

Answers (1)

Edgar Streuli
Edgar Streuli

Reputation: 248

You did well to add it to the static files, but you have to tell your app that you have an external js file.

There are two options to do this:

  1. In the page properties if you are only going to use the function on that page. Editing the javascript File URLs option

enter image description here

  1. In shared Components, in the details of User Interface Attributes.If you are going to use the function throughout the application.

enter image description here

After that, simply use your function on the trigger

Upvotes: 1

Related Questions