Visibility of Initiate Deployment UI button to Development Team

Nivedha G
Tera Contributor

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

2 ACCEPTED SOLUTIONS

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

View solution in original post

Hello @Nivedha G 

 

current.state=="25"&&current.u_change_request.nil()&&current.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

View solution in original post

10 REPLIES 10

Hello @Nivedha G 

 

It's because you have passed parameter in the script include method but not in the UI Action condition. 

 

There might be other modifications as well. Let me analyze this and share an updated script with you shortly. 

 

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

Hi @Shivalika 

     I have debugged the script include and found that there is no issue with script include ,but maybe there is issue with condition given in UI action

Hello @Nivedha G 

 

In that case, just pass the releasesysId as parameter in your UI Action. 

Like ➡️ current.RELEASE (parameter from your records)

If it doesn't works then I will analyze the script include as well. 

 

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

Hi @Shivalika 

    should this be included with the existing condition after the script Include one?

Hello @Nivedha G 

 

current.state=="25"&&current.u_change_request.nil()&&current.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