Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleAvailability

This routine is available starting with 

  • Power Scripts 2.5 (server)
  • SIL Engine (former katl-commons) 2.5


Syntax

lfExecuteJS(jsFilePath);

...

Excerpt
Gives you the possibility to run your own javascript code.

This routine gives you virtually unlimited power on Jira UI. However, note that this might not be portable across Jira versions.

Parameters

ParameterTypeRequiredDescription
jsFilePathStringYesThe script source to run that contains your javascript code. The file is resolved relative to silprograms path.

Example

Let's For this example we will first create a file which contains with the following javascript code :and save it on the disk as hook.js.

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

Save it on the disk as hook.js and  Now we call the lfExecuteJS routine like in the code block below:

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

For the jsFilePath parameter you can either give the relative path (as in the example above) or the absolute path.

When calling this routine 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.

The above routine gives you virtually all the power on Jira UI. However, this may NOT BE PORTABLE across versions of Jira.
Warning
titleImportant

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

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

The above script will be evaluated to

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

So the alert() will never be called.

Note
titleFor the technical minded
Code Block
/* Disable Edit Issue button */
AJS.$('#edit-issue').get(0).setAttribute("style", "pointer-events: none; opacity: 0.5;");


See also

Filter by label (Content by label)
22
showLabelsfalse
max35
showSpacefalse
sorttitle
cqllabel = "live_fieldslf_routines"
labelsjira_comment_routine