Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table plus
applyColStyleToCelltrue
heading0
columnTypess,s,s,s
multiplefalse
columnAttributesstyle="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,
enableSortingfalse

Syntax

lfExecuteJS(jsFilePath)

Package

Alias

Pkg Usage

Description

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

Gives you the possibility to run your own javascript code.

Parameters

Table plus
applyColStyleToCelltrue
columnTypess,s,s,s
heading0
multiplefalse
enableSortingfalse

Parameter name

Type

Required

Description

jsFilePath

String

Yes

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

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.

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

Now we call the lfExecuteJS routine 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 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.

Code Block
languagejs
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!

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

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

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

See also

Filter by label (Content by label)
showLabelsfalse
max25
showSpacefalse
cqllabel = "lf_routine" and space = currentSpace ( )
labelsarray_routines