Example scripts
To homepage
Jira

Make field read-only based on user groups
App in script

ScriptRunner For Jira
by Adaptavist
Compatibility

Jira
Language |
typescript
const ticketDepartment = getFieldById("customfield 10205")
const userRegion = getFieldById("customfield 10206")
const ticketCat = getFieldById("customfield 10207")
const priority = getFieldById("priority")
const group = "Example Group";
const user = await makeRequest("/rest/api/2/myself");
if (user) {
const { accountId } = user.body;
const userGroups = await makeRequest ("/rest/api/2/user/groups?accountId=" + accountId);
if (userGroups) {
const groupNames = userGroups.body.map(({ name }) => name);
if (groupNames.includes(group)) {
ticketDepartment.setVisible(false)
userRegion.setVisible(false)
ticketCat.setVisible(false)
priority.setReadOnly(true)
}
}
}
Having an issue with this script?
Report it here