Skip to end of banner
Go to start of banner

lfExecuteJS (Power Scripts)

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Description

Gives you the possibility to run your own javascript code.

Parameters

Return Type

None

Examples

Example 1

For this example we will first create a file with the following javascript code and save it on the disk as hook.js.

AJS.$('#summary-val').get(0).childNodes[0].nodeValue = "Executing my javascript";
AJS.$('#descriptionmodule').hide();

Now we call the lfExecuteJS function like in the code block below. For the jsFilePath parameter you can either give the relative path (as in the example above) or the absolute path. When this function is called, the javascript code from hook.js is executed. This will set the summary value on the issue page and will hide the description.

lfExecuteJS("hook.js"); // jsFilePath = "hook.js"

Example 2

The file designated by the jsFilePath parameter must contain only JavaScript code. Note that this code will be inlined, so do not use single line comments!

var v = "a";
// let's show an alert
alert(v);

The alert() will never be called because the script (above) will be evaluated to:

var v = "a"; // let's show an alert alert(v);

See also

  • No labels