Hi,
there is a requirement where 1 date field needs to be editable only for few users in a group or maybe not editable removing it from edit screen is not helping as it is getting removed from view screen as well cant use workflow as its not based on transition
tried to use ScriptRunner for the same with below script but its not working can anyone help with correction of the script-
const user = await makeRequest("/rest/api/2/myself");
const { accountId } = user.body;
const getRoles = await makeRequest(`/rest/api/2/user/groups?accountId=${accountId}`);
const roleNames = getRoles.body.map(({ name }) => name);
const role = "name of security group";
if (!roleNames.includes(role)) {
getFieldById("customfield_10534").setReadOnly(true);
}