RITM access only with a particular role

BenG
Tera Guru

Hi,

I would like to create a Business rule to allow acces to particular RITM to a particular role

To be clear, role "onboarding_user" must only see the "Onboarding" requested item.

This is my Business rule:

Query

Table: sc_req_item

Conditon: current.cat_item.name == "Onboarding"

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

if (!gs.hasRole("onboarding_user") && gs.isInteractive()) {

var u = gs.getUserID();
var qc = current.addQuery("opened_by", u);
gs.print("query restricted to user: " + u);
}
})(current, previous);

 

I don't know why when i add the condition current.cat_item.name == "Onboarding" it's doesn't work

Any idea ?

Regards,

1 ACCEPTED SOLUTION

BenG
Tera Guru

Hi,

I've find a very simple way to do that:

Business rule:

Query

table: sc_req_item

 

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

if (!gs.hasRole("user_role") && gs.isInteractive()) {

current.addQuery("cat_item","!=","sys_id_of_cat_item");

}

})(current, previous);

 

Regards,

 

 

View solution in original post

5 REPLIES 5

Ashish Srivast3
Tera Contributor

Good Day,

Why don't' you try out of box system functionality for this. Go on that item and add the role like onboarding_user. 

if you're not able to view role field then check UI policy or client script. 

Hope this should work.

Thanks!!

 

BenG
Tera Guru

I don't see roles option in Catalog item. I checked BR and client script but there is no way to display this option.

It's why I want to do that by BR

Okay, Go in system properties and search for property glide.sc.use_user_criteria and turn it to false and try again to view the role field. Must work!! find_real_file.png

 

Thanks!!

Ashish Srivast3
Tera Contributor

Okay. Go on system properties and search for glide.sc.use_user_criteria and turn its value to false and check again for role field on catalog item. Thanks!!find_real_file.png