Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Action Assignment on Change task should be visible to current assignment group members

ameybhaisar
Tera Contributor

I am working in change management. I have a requirement that the 'New' button under the related list 'Change Task' should be visible to only those who are members of the respective change requests assignment group. 

 

I have tried creating a Create ACL but it is hiding the New Button for everyone.

 

I then tried adding a condition in the Action assignment --   service-now.com/sys_declarative_action_assignment.do?sys_id=b062da24c30001102d32ce72a740dd64&sysparm_view

 

I tried with below code -- 

var ShowCloseTask = Class.create();
ShowCloseTask.prototype = Object.extend(new AbstractAjaxProcessor(), {

    initialize: function(current) {
        this.current = current;
    },

    checkCondition: function() {
        var abc = this.current.assignment_group;
        return gs.getUser().isMemberOf(abc);
    },

    type: 'ShowCloseTask'
});  But nothing seems to work..
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@ameybhaisar 

try this in script condition field

parent.active && gs.getUser().isMemberOf(parent.assignment_group.toString())

AnkurBawiskar_0-1746525621165.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@ameybhaisar 

try this in script condition field

parent.active && gs.getUser().isMemberOf(parent.assignment_group.toString())

AnkurBawiskar_0-1746525621165.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks, Ankur, for the prompt response. It worked perfectly.

I was just wondering if we have another scenario where we also want to check the respective change request's existing change tasks' assignment groups. Would it be possible through a script include and then calling the function here in the script condition?

@ameybhaisar 

yes you should be able to call script include from there and pass the parent.sys_id which is the CHG sysId and then have your logic defined.

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader