Change Request record should be closed only by Change co-ordinator and Assigned to person

Rooma1
Tera Contributor

Hi All,

 

I have a requirement to hide the 'Close Change' UI Action for the users (ITIL users from other group and Non ITIL users).

A Change Request should only be closed by the change co-ordinator and the Assigned to person who is having that CR.

Can someone please help me how to achieve this requirement?

Following are the only users allowed to close a change requests

 

1. members of the assignment group the change is assigned to
2. users with the change coordinator role

 

 

Thanks,

Rooma

2 ACCEPTED SOLUTIONS

Ayushi12
Mega Sage

Hi @Rooma1 ,
You can add the below script in the UI Action condition:
gs.hasRole('<req_role>') || (!current.assignment_group.nil() && gs.getUser().isMemberOf(current.assignment_group.toString()))

 

Please mark my answer as helpful and correct if it helped.

 

View solution in original post

Hi, @Rooma1 you can add the below condition with the previous conditions:
|| current.opened_by == gs.getUserID()

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

7 REPLIES 7

Ayushi12
Mega Sage

Hi @Rooma1 ,
You can add the below script in the UI Action condition:
gs.hasRole('<req_role>') || (!current.assignment_group.nil() && gs.getUser().isMemberOf(current.assignment_group.toString()))

 

Please mark my answer as helpful and correct if it helped.

 

Rooma1
Tera Contributor

@Ayushi12 

 

Thanks for the solutions. Can you please explain why 'current.assignment_group.nil()' this has been used, i understood the rest of the code.

@Rooma1 '!current.assignment_group.nil()' // It's for checking the condition like assignment_group is not null.

nil() -Determines if the field is null
Refer: https://developer.servicenow.com/dev.do#!/reference/api/vancouver/server/no-namespace/c_GlideElement...

Rooma1
Tera Contributor

Hi @Ayushi12 

 

If i need one more condition to add in the UI action for 'Opened by'.

 

If the User has opened the Change, then they should be able to close their own change.

 

Thanks,

Rooma