Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
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!
Include Page | ||||
---|---|---|---|---|
|
For Screens, select Issue create view and Issue view.
Click Projects, and then click Select projects in the right-hand panel.
Select the project or projects to which your configuration should be applied.
Click Issue types, and then click Select issue types in the right-hand panel.
Select the issue types to which your configuration should be applied (for example, Story and Task).
Under THEN, click Add Scripted action, and then click Start scripting in the right-hand panel.
Enter the following script:
Anchor lf-useCase-ProjectLead-EditOnly lf-useCase-ProjectLead-EditOnly Code Block // 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 }
Aura inline button | ||||
---|---|---|---|---|
|
Aura inline button | ||||
---|---|---|---|---|
|
You are viewing the documentation for Jira Cloud.