Versions Compared

Key

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

This routine is available starting with 

  • Power Scripts™ 2.5 (server)
  • SIL Engine™ (former katl-commons) 2.5
    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

    lfSet(field, value, [triggerChange])

    ...

    Package

    Alias

    Pkg Usage

    Description

    Excerpt
    hiddentrue
    Sets the field with the given values.

     Note that this sets the value on the screen only. It does not set the value on the issue because setting it on the issue requires direct access to the field.

    Parameters

    ...

    Sets the field with the given values.

    Parameters

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

    Parameter name

    Type

    Required

    Description

    field

    String

    Yes

    The field to set the value for.

    value

    String

    Yes

    The value to set. It can be a string value or an array with string values.

    triggerChange

    Boolean

    No

    If set to "true", it triggers the change event when lfSet is used on a field.

    ...

    Return Type

    None

    Examples

    Example 1

    The following code example sets the "Major" value for the standard Priority  fieldfield.

    Code Block
    languagejs
    lfSet("priority", "Major"); // where field = "priority" and value = "Major"
    Warning
    titleWarning

    The value will not be saved in the database. To save value in the database you should do something like:

    priority =
    "Major"
    ; // this saves the value into the database.However, make sure that you're not on the create screen.

    For fields that can accept multiple values, you can set multiple values as well. For example, you can set the components field to "comp1", "comp2".

    Code Block
    lfSet("components" , {"comp1", "comp2"});

    ...

    titleNote

    Note: You can't set a field if the values are not available for the given field. For example, in order to set the components field to "comp1", "comp2", you have to make sure that "comp1" and "comp2" are valid components for that issue.

    ...

    Code Block
    languagejs
    lfSet("components" , {"comp1", "comp2"});

    Example 2

    If you try to set an issue type field using an array like the code below, lfSet will take into account only the first value from the array. So, this will set the issue type to "Task".

    ...

    Code Block
    languagejs
    lfSet("issueType", {"Task", "Bug"});

    If you want to trigger the change event on the field when using lfSet, you can use the optional triggerChange parameter set to "true":

    Known Issues
    Code Block
    languagejs
    lfSet("customfield_10000", "updated val", true);
    Info
    title

    Note

    You can?t set fields that are uneditable. For example, on the issue view screen you can?t set status or resolution fields.

    Info
    There are certain fields, from the list provided in Fields and graphic elements supported by Live Fields, that you can’t set the value for:
    • Labels, on Edit, Transition, Create screens
    • Estimate (remaining estimate), on Transition screens
    • Votes
    • Watchers
    On the view screen, if you want to edit a field the last value saved for that field will be displayed.

    You can’t set fields that are uneditable. For example, on the issue view screen you can’t set status or resolution fields.

    See also

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