Versions Compared

Key

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

This routine is available starting with 

  • Power Scripts 2.5.6 (for Jira 5.x) and 2.6.1 (for Jira 6.x)
  • katl-commons 2.5.8 (for Jira 5.x) and 2.6.1 (for Jira 6.x)
    Info
    titleAvailability
    Table plus
    applyColStyleToCelltrue
    heading0
    columnTypess,s,s,s
    multiplefalse
    columnAttributesstyle="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,
    enableSortingfalse

    Syntax

    lfInstantHook(relatedFields, scriptPath);

    Package

    Alias

    Pkg Usage

    Description

    Excerpt
    hiddentrue
    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 Executes the given SIL script passing the screen values for the desired specified dependent fields as argv["field"] in the hook (relatedFields) as parameters to the script.

    Parameters

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

    Parameter name

    Type

    Required

    Description

    relatedFields

    String Array

    Yes

    Dependent fields required for the given field (needed only if you get the field's values from the screen like this:

    ...

    argv["field"])

    scriptPath

    String

    Yes

    Script source to run when the event is triggered

    ...

    Return Type

    ...

    None

    Example

    For the scriptPath parameter you can either give the relative path

    ...

    or the absolute path:
    C:/Program Files/Atlassian/Application Data/JIRA/silprograms/hook.sil.

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

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

    Image Removed

    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.

    Image Removed 

    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.

    For more information, see How Live Fields work.
    Info
    titleInfo
    Code Block
    // hook.sil
    if (contains(argv["summary"], "important")) {
        lfSet("priority", "Highest");
        lfShowFieldMessage("priority", "Priority changed", "INFO");
    }

    See also

    Filter by label (Content by label)
    showLabelsfalse
    max3525
    showSpacefalsesorttitle
    cqllabel = "lf_routine" and space = currentSpace ( )
    labelsarray_routines