Skip to end of banner
Go to start of banner

lfInstantHook

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 11 Current »

Availability

This routine is available starting with 

  1. for Jira 5.X
    • Power Scripts 2.5.6 (server)
    • SIL Engine™ (former katl-commons) 2.5.8
  2. for Jira 6.X
    • Power Scripts™ 2.6.1 (server)
    • SIL Engine™ (former katl-commons) 2.6.1

Syntax

lfInstantHook(relatedFields, scriptPath);

Description

Executes the given SIL script passing the screen values for the specified dependent fields (relatedFields) as parameters to the script.This is especially useful in the create issue screen, where you don't have access to the issue standard variables. Using an instant hook, you can access the screen values for the desired fields as argv[field] in the hook script.

Parameters

ParameterTypeRequiredDescription
relatedFields

String Array

YesDependent fields required for a given field
scriptPathStringYesScript source to run when the event is triggered

Example

lfInstantHook({"summary", "customfield_13706", "components"}, " hook.sil");

For the scriptPath parameter you can either give the relative path (as in the example above) or the absolute path:
C:/Program Files/Atlassian/Application Data/JIRA/silprograms/hook.sil.

// hook.sil : 
 if (contains(argv["summary"], "important")) {
	lfSet("priority", "Highest");
	lfShowFieldMessage("priority", "Priority changed", "INFO");
 }

Every time when the initial script is triggered, the hook.sil is executed. When the summary field contains the word “important”, the Priority field is set to "Highest" and a message will be displayed for the Priority field.

The first image shows the initial value of the priority for the current issue, the next one shows the value it is changed to, after executing the code from hook.sil.

 

The values from the relatedFields are accessed as argv[field]. For multiple values fields like components or affectedVersions,  the value returned is in the following format: val1|val2|val3.


Info

For more information, see How Live Fields work.

See also

  • No labels