There are two scripting extensions in Report Designer: global, and per-query. The global script can be used to define shared functions or global variables that are available to all query scripts. With a global script, you can dynamically change the data source configuration via the init()function.
Per-query scripts enable you to customize a query string, calculate the "additional fields" information for query-caching, and post-process the returned table model.
An external script that is local to Report Designer will probably not be local to the Pentaho Server, since most production BI environments separate the server from the design tools. So if you publish a report to the server, you must either change the path to the external script so that it will work on the server, or find a way to include it in the correct relative path on the Pentaho Server.