Change Request form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2024 03:17 AM
Hi All,
There is requirement where i need to add a field of List type called as 'Peer Review' on the change request form.
I have created the field and need to put the condition on that field that the Requestor should be able to choose one or more people from the Assignment group as their Peer Reviewers and put a validation to restrict the Requester and Assigned to, to approve the record.
I am not able to understand how to put that condition so that the members of the assignment group only should be visible in that field and it should exclude Requester and Assigned to from that list of users.
Can someone please help on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2024 03:58 AM
Create busines rule
(function executeRule(current, previous /*null when async*/) {
var assignmentGroup = current.assignment_group; // Replace with your field name
var peerReviewers = current.peer_reviewers; // Replace with your field name
if (peerReviewers) {
var groupMembers = new GlideRecord('sys_user_grmember');
groupMembers.addQuery('group', assignmentGroup);
groupMembers.query();
var validPeerReviewers = [];
while (groupMembers.next()) {
validPeerReviewers.push(groupMembers.user.sys_id + '');
}
var isValid = true;
peerReviewers.split(',').forEach(function(peer) {
if (validPeerReviewers.indexOf(peer) === -1) {
isValid = false;
}
});
if (!isValid) {
gs.addErrorMessage('Peer Reviewers must be members of the Assignment Group.');
current.peer_reviewers = ''; // Clear the invalid selection
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2024 04:39 AM
Hi @roomawakar
Make use of below Advanced Reference Qualifier for your List Collector field as shown below :
javascript:'sys_id!='+current.requested_by+'^ sys_id!='+current.assigned_to;
Output :
In the below change, the requestor is System Administrator and Assigned To is David Loo :
When I try to get the above users in the list collector reference, below is the output :
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2024 05:00 AM
@Amit Verma Thanks for the solution but here I need all the members of the current assignment group which has been selected on the Change request except the requester and the assigned to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2024 05:07 AM
In that case, you can refer below posts to setup a Script Include and call it from reference qualifier. In the Script Include, you can also keep the logic to get rid of the requestor and assigned to user from the output.
Please mark this response as correct and helpful if it assisted you with your question.