I'm creating a JS callout policy that will invoke code in a JavaScript file. Let's call it A.js.
How do I make a call to a function doSomething() in another JavaScript file called B.js?
Is there a way to 'include' or 'import' or 'require' B.js in A.Js?
Appreciate the help.
Solved! Go to Solution.
Yes, there is.
When you define your Javascript policy, include B.JS in the IncludeURL as shown below
<Javascript async="false" continueOnError="false" enabled="true" timeLimit="100" name="your-javascript-name"> <DisplayName>JavaScript 1</DisplayName> <ResourceURL>jsc://A.js</ResourceURL> <IncludeURL>jsc://B.js</IncludeURL> </Javascript>
The above would have the same semantics as if you "imported" B.js into A.js
Keep in mind that B.js needs to exist next to A.js or it needs to be uploaded as an organization level resource.