[All Adaptavist Apps]

Page tree

Example Behaviour: Change Field Name 

This example shows you how to change the name displayed for a specific field within the issue creation screen. Specifically, in this example, the field entitled Summary is changed to Ticket Title in response to the preferences of a particular team.

Follow the steps below to create the behaviour:

  1. Open the Behaviours tab and click the Create Behaviour button.

    You will see the Create Behaviour screen displayed:
  2. Enter a name and description for the behaviour. It's good practice to make these as descriptive as possible.
  3. Ensure the Enable Behaviour toggle is activated.
  4. Scroll down to the Behaviour Mapping section and select the relevant Project to which this behaviour will be mapped. For this example, choose the Customer Success project.
  5. Select the Issue Type that will be associated with the behaviour. For this example, choose the Task issue type.
  6. Scroll down to the Behaviours Fields section and click Add Field.
  7. Choose the field that will change (affected) once the behaviour has been applied. For this example, choose the Summary field.

  8. Click Next.

  9. Define when the script should run. This can be when the issue creation screen loads initially and/or in response to a field change. For the purposes of this example, check the On load option so that the summary field is renamed when the issue creation screen loads.

    WhenRuns
    On load

    The script will run when the create screen initially loads.

    You'll want to choose this option when you want the affected field to populate immediately upon opening the create screen. 

    For example, a field name or field description is changed, or a value is pre-populated into the field.

    On change

    The script will run when the specified supported field change happens.

    You'll want to choose this option when you've added a condition to the logic and identified a trigger that will update the affected field. 

  10. Edit the script within the Script box as required. 

  11. Click Save once you have confirmed the parameters as getFieldById("summary").setName("Ticket Title");.
    Now that you have created the behaviour to run when the screen loads, you will see the field entitled 'Summary' change to 'Ticket Title' when you create new tasks within the Customer Success project.
  12. Refresh your screen and click on the Create button in order to see the behaviour in action. 
    If you are creating behaviours for the first time since installing the ScriptRunner Behaviours app, then you are prompted to click the Allow Access button, as shown below:

    Atlassian’s initial beta release of the UI Modifications API requires each user to allow access to the Behaviours app. As such, the first time you create an issue where a behaviour is mapped, you will need to allow access to the Forge app (one time only).

    Granting access allows you to create issues on a screen that has been modified by the UI Modifications API. If access is not granted, then you will not be able to create an issue from screens that have been modified by a behaviour.

    Granting access is a temporary step; rest assured, Atlassian is working to improve the user experience and remove it. You can follow Atlassian’s ticket here.

    After access has been granted, the following screen displays: 

    Once you have clicked on the Accept button, you are returned to the Create issue screen, where you will see your changes, as shown below:

  13. If you wish to revert back to the original field name, simply click Edit from the ellipsis menu next to your chosen behaviour, as shown below:

    and deselect the Enable Behaviour button.