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.

Security attributes doesn't work

thiagofemeira
Tera Contributor

Hi all,

 

I am trying to create some customized Security Attributes with Data filtration, but it doesn't work.

 

My objective is simple: Give access to Incidents assigned to the group "Network" only for user with the department "Sales".

 

Then I have created the following Security attribute:

thiagofemeira_0-1719845290256.png

*I also have tried using string type.

 

I also have created the following Data Filtration:

thiagofemeira_1-1719845419927.png

 

But it doesn't work.

with that gs.log I can see that the script is executed, but the data filtration cannot deal with the security attribute.

 

Does anyone know what could be wrong?

 

 

2 REPLIES 2

Nia McCash
Mega Sage
Mega Sage

I've tried something similar with a custom Security Attribute for department and it's also not working. Did you every figure this out?

Bert_c1
Kilo Patron

A Query business rule can do what is asked. That runs Before for the incident table.

 

Screenshot 2025-01-12 105704.pngScreenshot 2025-01-12 105717.png

 

Script:

// Give access to Incidents assigned to the group "Network" only for user
// with the department "Sales".
var usr = gs.getUserID().toString();
var suser = new GlideRecord('sys_user');
suser.addQuery('sys_id', usr);
suser.query();
if (suser.next() && suser.department == '221db0edc611228401760aec06c9d929') {
	// gs.info('BR: user: ' + usr + ', dept: ' + suser.department);
	current.addQuery('assignment_group', '8a5055c9c61122780043563ef53438e3');
}