[All Adaptavist Apps]

Page tree

Versions Compared

Key

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

You can reference the following functions and properties within your behaviour scripts:

Methods

getName()

Returns the name of the affected field.

Return type

String

getDescription()

Returns the description of the affected field.

Return type

String or Atlassian Document Format object depending on how your instance is configured

getValue()

Returns the value of the affected field.

The type of value depends on the affected field you have chosen.

Affected fieldType
SummaryString
DescriptionString or Atlassian Doc Format depending on how your instance is configured.
LabelsString[]
Priority

{

     iconUrl: string,

     name: string,

     id: string

}

Assignee

{

    accountId: string,

    displayName: string,

}

getId()

Returns the Id of the affected field.

Return type

String

isVisible()

Returns a boolean indicating whether or not the affected field is visible.

Return type

boolean

getFieldById(fieldId)

Returns information about a specific field and then allows you to call the set methods outlined below on that field to set properties on the field.

 Parameters
NameTypeDescription
fieldidStringID of the field. Note that only affected fields are supported.
Return type
Code Block
{

     getName(): string,

     getDescription(): string,

     getID(): string,

     getValue(): depends on the field, see table in getValue above

     isVisible(): boolean

}


getFieldById(fieldId).setName(name)

Updates the name of the affected field.

Parameters
NameTypeDescription
nameStringThe new value for the name field.
getFieldById(fieldId).setDescription(description)

Updates the description of the affected field

Parameters
NameTypeDescription
descriptionString or Atlassian Doc Format ObjectThe new value for the description field.
getFieldById(fieldId).setValue(value)

Updates the value of the affected field.

The value parameter will depend on the affected field you have chosen.

Affected fieldType
SummaryString
DescriptionString or Atlassian Doc Format depending on how your instance is configured.
LabelsString[]
Priority

{

     iconUrl: string,

     name: string,

     id: string

}

assignee

{

    accountId: string,

    displayName: string,

}

getFieldById(fieldId).setHidden()

Hides the specified field if is visible on the current screen.

getFieldById(fieldId).setVisible()

shows the specified field if is visible on the current screen.

makeRequest(path)

Used to make a request to the Jira Cloud REST API.


Note
titleCaveats
  • Currently, the makeRequest() method only supports making GET requests.
  • Currently, the makeRequest() method only supports calling the Jira Core Cloud or Jira Software Cloud Rest API's
Parameters
NameTypeDescription
pathStringREST endpoint to hit e.g /rest/api/2/myself
Return Type

Promise<{ status: number, body: JSONObject}>

Parameters

logger

An object containing functions used for logging

Available logger functions

  • trace
  • debug
  • info
  • warn

Follow the steps below to create a behaviour in ScriptRunner for Jira Cloud:

...

  1. Click Create Behaviour from the previously created list. You can also Edit or Delete your selected behaviour via the Actions ellipsis on this page.
    Image Removed
    OR
  2. Click Create Behaviour from the initial landing screen if no behaviours have been previously created.
    Image Removed

...