1.0.6 • Published 4 months ago

@scriptrunnerhq/vendors-api v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

ScriptRunner Vendors API

This library will allow you to integrate your custom field with Behaviours for ScriptRunner for Jira Data Center.

This API will be supported in ScriptRunner for Jira in an upcoming version yet to be determined.

Installation

  1. Add @scriptrunnerhq/vendors-api to your package.json.
  2. Run npm install or yarn install.
  3. In the server-side template file add two data properties to the root node:
    • data-scriptrunner-vendors-api-cfid - with the value of custom field ID.
    • data-scriptrunner-vendors-api-stored-value - with the value stored in the database.
  4. In your custom field code, ensure that VendorsApi.init() is called immediately when your field is initialized.

VendorsApi.init()

VendorsApi.init() is how you connect your custom field with ScriptRunner Behaviours. It takes two arguments: 1. customFieldId - the unique ID assigned by Jira for the field. 2. apiSpec - an object with API functions: getValue() - return the current value of custom field. setValue(value) - set value of the custom field. setReadOnly(readOnly) - enables or disables the custom field based on readOnly boolean argument. bindOnChange(callback) - a callback to inform ScriptRunner Behaviours that the value of the custom field has changed. setOptions(options) - (optional) for fields like select provides a list of available options in the form of {key: string, value: string}[]. isPopulated() - (optional) determines if the field is populated with data, to inform ScriptRunner of mandatory fields not filled in.

Note: The getValue() and setValue() should be symmetric, meaning both should return/accept values in the same format. These values should match the data format stored in the database.

It is important to call VendorApi.init() as early as possible, as any of the above functions may be called early from ScriptRunner Behaviours. This means that all of the above can be called before the custom field is fully initialized. For this reason all of the above can return Promise and internally wait for custom field initialization to finish before applying a Behaviour.

More information and an example plugin can be found in our Documentation.

We also provide an example plugin demonstrating how this API can be used.

1.0.6

4 months ago

1.0.6-snapshot.2

4 months ago

1.0.5-snapshot

5 months ago

1.0.6-snapshot.1

5 months ago

1.0.6-snapshot.0

5 months ago

1.0.5-snapshot.0

5 months ago

1.0.5

6 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago