Highlighted
Absent Member.
Absent Member.
248 views

Include configurable text in script from ScriptLibrary

I have a script that makes an http request with a hard coded url - how do I make this configurable so that the users can edit it in the future without having to edit the script?

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Include configurable text in script from ScriptLibrary

Without more detail I am not sure how 'editable' it needs to be and by what mechanism.

If you simply want an admin to be able to change the URL without changing your script you can put the url in a seperate SL called CustEndPoint that would contain 1 line:

function webservice1() { return "http://whatever" };

then in your script the url would be

var url = lib.CustEndPoint.webservice1();

and your script would never need to change.  The admin could change the url in CustEndPoint when needed.

If you mean how to let an end user do this from the UI, then you need a form, with a url field and then you pass that url into your JS as a parameter to a function.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.