I want to create which is Department is NOT Network how to write a script for the same

kranthi2
Tera Expert

Hi,

I want to create which is Department is NOT Network how to write a script for the same.

 

Please help me out with the script so that I don't want to show some of the items Department is Not Network.

 

kranthi2_0-1702294896337.png

 

6 REPLIES 6

@kranthi2 

so handle it via script

// check if logged in user does not belong to Network department

var grSysUser = new GlideRecord('sys_user');
grSysUser.addQuery('sys_id', user_id);
grSysUser.addEncodedQuery("department.name!=Network");
grSysUser.query();
answer = grSysUser.hasNext();

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

Hi Ankur,

It is not working as per expectation.

 

Thanks,