Create a live field configuration

In this example, you will create a live fields configuration that makes a custom field Read Only for any user who is not a Project Lead.

Note: the script included below contains a placeholder reference to a custom field - customfield_12345. You should replace this with your own custom field ID!

  1. For Screens, select Issue create view and Issue view.

  2. Click Projects, and then click Select projects in the right-hand panel.

  3. Select the project or projects to which your configuration should be applied.

  4. Click Issue types, and then click Select issue types in the right-hand panel.

  5. Select the issue types to which your configuration should be applied (for example, Story and Task).

  6. Under THEN, click Add Scripted action, and then click Start scripting in the right-hand panel.

  7. Enter the following script: 

    // Make the "Priority" field editable only for the Project Lead // Get the current user context, including accountId and project details const context = await getContext(); const { accountId, extension: { project } } = context; // Fetch details of the current project using its ID or key const projectDetails = await JiraApi.ProjectsService.getProject({ projectIdOrKey: project.id }); // Get the project lead information from the project details const projectLead = projectDetails.lead; // Allow editing of the custom field only if the current user is the project lead if (accountId === projectLead.accountId) { getFieldById("customfield_12345").setReadOnly(false); // Make field editable } else { getFieldById("customfield_12345").setReadOnly(true); // Make field read-only }

Next up: Feature comparison

You are viewing the documentation for Jira Cloud.

useCase-OnlyProjectLeadEditField.png
Figure 1 - Script configuration

 

Play the Arcade

https://app.arcade.software/share/FkrMzflOX9C4VvzZXnQl

Â