Extension fields

Aha! Develop

Each record in Aha! Develop can store arbitrary data per extension. This allows an extension to store state in Aha! Develop that is available when the extension is rendered or when extension code executes.

Extension fields are deleted from each record if the extension is deleted. Each record model has functions for storing and retrieving extension fields.

Click any of the following links to skip ahead:

setExtensionField

Set the value of a field on an extension:

async function setExtensionField(extensionIdentifier, fieldName, value)

Where:

  • extensionIdentifier: the identifier of the extension storing the data. It is possible for one extension to store data on behalf of another extension using this parameter.

  • fieldName: the name of the field. Multiple fields can be stored for each extension. Using multiple fields rather that a nested JSON object in the value can help prevent race conditions with read-modify-update cycles.

  • value: any JSON value.

setExtensionField returns nothing.

Here is an example:

await record.setExtensionField('aha-develop.github', 'prs', [1234, 5342])

Top

getExtensionField

Read the value of an extension field for a record. View contributions include all field values in their render callback so this function is not necessary in many cases.

async function getExtensionField(extensionIdentifier, fieldName)

Where:

  • extensionIdentifier: the identifier of the extension storing the data.

  • fieldName: the name of the field to retrieve a value for.

Returns the value that was previously stored in the field or null if no value was stored. For example:

const featureValue = await record.getExtensionField('acme-corp.planning-poker', 'value')

Top

getExtensionFields

Read the value of all fields stored by the extension on a record.

async function getExtensionField(extensionIdentifier)

Where:

  • extensionIdentifier: the identifier of the extension storing the data.

Returns an object where the keys are the names of the fields and the values are the stored value for each field.

Top