Skip to main content
1 of 2
Mihail
  • 2.1k
  • 14
  • 19

The ScriptSrc attribute is only applicable when the Location attribute is set to ScriptLink.

What you need to do is to remove the ScriptSrc attribute from your custom action, and then create an additional custom action that serves the script. See below:

<CustomAction Id="ScriptSource1"
              ScriptSrc="/mysite/siteAssets/function.js"
              Location="ScriptLink"
              Sequence="100">
</CustomAction>

If you do not want to have 2 custom actions, then you need to write JS code that loads the JS file and then executes your function. That JS code would have to be placed inside CommandAction attribute like this:

CommandAction="javascript: <JS code that loads JS file from Site Assets>;
                           JsFunctionInJsFileInSiteAssets();"

References:

Mihail
  • 2.1k
  • 14
  • 19