- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 10:38 AM
Hi,
The Initiate Deployment button is currently visible to Release coordinator, but now there is a condition needed where it should be also visible to Development Team (We have to get development team group name from Feature record). I have given a script under Initiate Deployment UI action but the issue is now its showing for all the users and the script is not checking for Development Team.
function isUserInFeatureDevelopmentTeam() {
var grFeature = new GlideRecord('rm_feature');
grFeature.addQuery('parent', current.sys_id);
grFeature.query();
while (grFeature.next()) {
var devTeam = grFeature.u_development_team;
if (devTeam) {
var grTeamMember = new GlideRecord('sys_user_grmember');
grTeamMember.addQuery('group', devTeam);
grTeamMember.addQuery('user', gs.getUserID());
grTeamMember.query();
if (grTeamMember.hasNext()) {
return true;
}
}
}
return false;
}
And in condition field of the UI action I have included the function name :
current.state == "25" &&
current.u_change_request.nil() &&
(current.assigned_to == gs.getUserID() || isUserInFeatureDevelopmentTeam());
What might be the issue here? Thanks in Advance
Solved! Go to Solution.
- Labels:
-
Release Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 11:14 AM
Hello @Nivedha G
It doesn't works like that. You cannot write function in script section and call it in condition because condition is evaluated first and it doesn't has access to function you have written. So it will get null.
Please wrap this function in a script include and call that script include in your UI script condition part.
&& ScriptIncludeName().METHODName()
Method in which you wrote this script then it will work.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2025 03:25 AM
Hello @Nivedha G
current.state=="25"&¤t.u_change_request.nil()&¤t.assigned_to==gs.getUserID() && CheckDevelopmentTeamAccess().isUserInFeatureDevelopmentTeam(current.RELEASEFIELD)
Use above in the condition.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 10:49 AM
Hello @Nivedha G
Where have you written this function ?
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 10:53 AM
This function is written in the script section of Initiate Deployment UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 11:14 AM
Hello @Nivedha G
It doesn't works like that. You cannot write function in script section and call it in condition because condition is evaluated first and it doesn't has access to function you have written. So it will get null.
Please wrap this function in a script include and call that script include in your UI script condition part.
&& ScriptIncludeName().METHODName()
Method in which you wrote this script then it will work.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2025 02:39 AM
Hi @Shivalika
I have added the script include
var CheckDevelopmentTeamAccess = Class.create();
CheckDevelopmentTeamAccess.prototype = {
initialize: function () {},
isUserInFeatureDevelopmentTeam: function (releaseSysId) {
var userId = gs.getUserID();
var grFeature = new GlideRecord('rm_feature');
grFeature.addQuery('parent', releaseSysId); // Get features linked to the Release
grFeature.query();
while (grFeature.next()) {
var devTeam = grFeature.getValue('u_development_team'); // Get development team (group)
if (devTeam) {
var grTeamMember = new GlideRecord('sys_user_grmember');
grTeamMember.addQuery('group', devTeam);
grTeamMember.addQuery('user', userId);
grTeamMember.query();
if (grTeamMember.hasNext()) {
return true; // User is in the development team
}
}
}
return false;
},
type: 'CheckDevelopmentTeamAccess'
and then have include the script include in condition field of UI action to the exisiting one:
current.state=="25"&¤t.u_change_request.nil()&¤t.assigned_to==gs.getUserID() && CheckDevelopmentTeamAccess().isUserInFeatureDevelopmentTeam()
But after inlcuding this also Initiate Deployment button is not visible to development team and before it was visible to release coordinator now its not visible for them as well now.Could you please help us in this.Thanks in advance