Skip to end of banner
Go to start of banner

lfExecuteJS

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

« Previous Version 4 Next »

Availability

This routine is available since 

  1. Power Scripts for JIRA 2.5 (formerly known as JJUPIN)
  2. katl-commons 2.5


Syntax

lfExecuteJS(jsFilePath);

Description

Gives you the possibility to run your own javascript code.

Parameters

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

Example

Let's first create a file which contains the following javascript code:

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

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

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, the javascript code from hook.js is executed.

This will set the summary value on the issue page and will hide the description.

Important

The file designated by the jsFilePath patameter 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 above script will be evaluated to

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

So the alert() will never be called.

For the technical minded

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

See Also:

  • No labels