Help In Scripting

DKSINGH
Tera Contributor

Hi Techies,

I am following one of the KB of ServiceNow

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0790987 

But somehow it is not working as expected. When I am executing it, it is completely Hiding the Incident, not even visible to group member not to admins.

Suggestions would be appreciated.

-------------------------------------------------------

My Script

(function executeRule(current, previous /*null when async*/ ) {

var grp = current.addNullQuery('assignment_group').addOrCondition('assignment_group','!=','81d9b6f21bf1ce9851e0eb52604bcb7f');

})(current, previous);
-----------------------
DKSINGH_0-1717066015160.png

 

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @DKSINGH ,

please try with below code 

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	current.addQuery('assignment_group','!=','81d9b6f21bf1ce9851e0eb52604bcb7f');

})(current, previous);

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

View solution in original post

4 REPLIES 4

Community Alums
Not applicable

Hi @DKSINGH ,

please try with below code 

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	current.addQuery('assignment_group','!=','81d9b6f21bf1ce9851e0eb52604bcb7f');

})(current, previous);

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

Hi Sarthak,

Thanks for the response,

it is also showing same behaviour, INC is completely not visible to others and even to groups member and admin.

It worked, after using sys_id of the assignment group instead of group name.
Thanks @Community Alums 

Hi Sarthak,

Can you please also Guide on the condition, how to achieve

My requirement is basically I have created an additional view on Security Incident table which will be used by members of different teams who are divided by different Business Units, that means that team is having multiple Assignment Groups. So 

Default View Will be used By D1, D2 & D3
Custom View Will be used By C1, C2,C3,C4,C5,C6.

And both should not see Incident Assigned to each others View, but they can see Incidents of each other among their specific views