Versions Compared

Key

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

This routine is available since starting with 

JJUPIN
  • Power Scripts™ 2.5 (server)
  • SIL Engine™ (former katl-commons) 2.5

Syntax

lfSet(field, value, [triggerChange]);

Description

Excerpt
Sets the field with the given values.

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

Parameters

ParameterTypeRequiredDescription
fieldStringYesThe field to set the value for.
value

String

YesThe value to set. It can be a string value or an array with string values.
triggerChangeBooleanNoIf set to "true", it triggers the change event when lfSet is used on a field.
Available since starting with v. 2.5.6 for Jira 5.x and v. 2.6.1 for Jira 6.x.

Examples

The following code example sets the "Major" value for the priority standard field as Major Priority field.

Code Block
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 the value.

However, please make sure that you're not on the create screen!

...

.

For fields that can accept multiple values, you can set multiple values to a field that can have multiple valuesas well. For example, let's you can set the components field to "comp1", "comp2".

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

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. 

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
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":

Code Block
lfSet("customfield_10000", "updated val", true);
Info
titleKnown Issues

There are some certain fields, from the list provided in Supported fields Fields and graphic elements supported by Live Fields, that couldn’t you can’t set the value for. These fields are:

  • Labels, on Edit, Transition, Create screens;
  • Estimate (remaining estimate), on Transition screens;
  • Votes
  • Watchers

On the view screen, when if you want to edit a field will be displayed the last value saved for that field will be displayed.

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

See

...

also

Filter by label (Content by label)
showLabelsfalse
max35
showSpacefalse
sorttitle
cqllabel = "live_fieldslf_routines"