Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 03:24 AM
After the change has left the 'New' state make the following fields read-only on the change task if the user does not have the 'change_manager' or 'admin' roles
- Affected CI
- Priority
- Due Date
- Change Request
- Assignment Group
- Assigned To
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 07:55 AM
Tried using UI Policy but it didnt worked, used g_user function in UI policy script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2024 01:49 AM - edited ‎10-23-2024 03:11 AM
Hi @shatakshi10 ,
You need to retrieve data from the server side because the change request state is only stored there.
Please follow the steps below to achieve this:
1. Write an onLoad client script for the task table.
function onLoad() {
var ga = new GlideAjax('ChangeRequestState');
ga.addParam('sysparm_name', 'getState');
ga.addParam('sysparm_change', g_form.getValue('change_request'));
ga.getXMLAnswer(getCall);
function getCall(response) {
if (response != '-5' && !g_user.hasRole('change_manager') && !g_user.hasRole('admin')) {
// It’s essential to mark the first field as not mandatory, as mandatory fields cannot be set to read-only.
g_form.setMandatory('cmdb_ci', false);
g_form.setMandatory('priority', false);
g_form.setMandatory('assignment_group', false);
g_form.setMandatory('assigned_to', false);
g_form.setReadOnly('cmdb_ci', true);
g_form.setReadOnly('priority', true);
g_form.setReadOnly('assignment_group', true);
g_form.setReadOnly('assigned_to', true);
}
}
}
2) Write a client callable script that includes the role for public access, allowing anyone to access it.
var ChangeRequestState = Class.create();
ChangeRequestState.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getState: function() {
var change_id = this.getParameter('sysparm_change');
var changeGR = new GlideRecord('change_request');
changeGR.get(change_id);
return changeGR.state;
},
type: 'ChangeRequestState'
});
Output :
Hope this help you.
Regards
Moin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 03:38 AM - edited ‎10-24-2024 04:19 AM
Users without the 'change_manager' or 'admin' roles should also not have an 'Edit' button on the 'Affected CIs' related list on the change task record once the new state has left.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 04:08 AM
You can configure all list-related functionality through list control. This includes role-based buttons, filters, links, and much more. Just visit list control to access a variety of features.
If you want the New and Edit buttons to be visible only to users with the admin or change_manager roles, please refer to the image provided.
To open list control for a specific related list, follow the steps below:
Go to Specific Related List > Right Click On any Column > Configure > List Control
Thanks,
Moin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 04:13 AM
Users without the 'change_manager' or 'admin' roles should also not have an 'Edit' button on the 'Affected CIs' related list on the change task record once the new state has left.