Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

How to restrict metric type on metric result table

Balakrishna_ABK
Kilo Sage

mt.png

I want to hide NPS Metric type from asmt_metric_table and make visible only to specific role so that survey viewer should only see all other metric results and not NPS metric type 
Note: even in reporting they shouldn't access this NPS Metric type

1.If acl is solution which type of acl is preferable ?
2.What if we store these results in separate custom table ?

1 ACCEPTED SOLUTION

Tanushree Maiti
Tera Patron

Hi @Balakrishna_ABK 

 

Try this :

 

  1. Create the Custom Role
  • Navigate to User Administration > Roles > click New.
  • Name the role (like  nps_viewer).
  • Click Submit.

 

2.Configure a Read ACL on the Metric

  • Navigate to System Security > Access Control (ACL)>Click New.
  • Operation: read
  • Name: Select the Assessment Metric table.
  • Condition: Set a condition to isolate the NPS metric (e.g., Metric type is NPS or Name is your NPS metric name).
  • Roles: In the "Requires role" related list, add the specific role you just created (like nps_viewer) and any admin roles.
  • Click Submit.

Note: Users without the nps_viewer role will no longer see the NPS metric when viewing surveys.

 

3.Configure a report_view ACL for Reporting

To prevent users from selecting the NPS metric in reports and dashboards, add a Report View ACL.

  • Navigate to System Security > Access Control.
  • Click New.
  • Operation: report_view.
  • Name: Select the Assessment Metric table.
  • Roles: In the "Requires role" related list, add the nps_viewer role.
  • Click Submit.

Note: This prevents unauthorized users from using the NPS metric as grouping or filtering criteria in their reports.

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@Balakrishna_ABK 

Table.None READ ACL will be the preferable way with proper conditions etc

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

AednaR
Tera Expert

Hi @Balakrishna_ABK ,

Since you want to restrict access to a subset of records (only NPS metrics), use a record ACL on the metric table rather than a UI policy or module visibility.
Typically:

asmt_metric → Metric definitions
asmt_assessment_instance_question / result tables → Responses
Reporting reads underlying tables, so ACLs apply there as well.
Can create a Read ACL on the relevant table.

Tanushree Maiti
Tera Patron

Hi @Balakrishna_ABK 

 

Try this :

 

  1. Create the Custom Role
  • Navigate to User Administration > Roles > click New.
  • Name the role (like  nps_viewer).
  • Click Submit.

 

2.Configure a Read ACL on the Metric

  • Navigate to System Security > Access Control (ACL)>Click New.
  • Operation: read
  • Name: Select the Assessment Metric table.
  • Condition: Set a condition to isolate the NPS metric (e.g., Metric type is NPS or Name is your NPS metric name).
  • Roles: In the "Requires role" related list, add the specific role you just created (like nps_viewer) and any admin roles.
  • Click Submit.

Note: Users without the nps_viewer role will no longer see the NPS metric when viewing surveys.

 

3.Configure a report_view ACL for Reporting

To prevent users from selecting the NPS metric in reports and dashboards, add a Report View ACL.

  • Navigate to System Security > Access Control.
  • Click New.
  • Operation: report_view.
  • Name: Select the Assessment Metric table.
  • Roles: In the "Requires role" related list, add the nps_viewer role.
  • Click Submit.

Note: This prevents unauthorized users from using the NPS metric as grouping or filtering criteria in their reports.

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Hi @Tanushree Maiti , 

Thanks for your information.

 

I don't want to create ACL instead i am using query business rule and is working fine

(function executeRule(current, previous) {
 
var surveyId = '2fca585e0a0a0bb400a949f8bb843712';
// Admins can see all records
if (gs.hasRole('admin')) {
return;
}
// chat_survey_viewer users see only required survey records
if (gs.hasRole('chat_survey_viewer')) {
current.addQuery('source_id', surveyId);
} else {
// Everyone else cannot see survey records
current.addQuery('source_id', '!=', surveyId);
}
 
})(current, previous);

Is there any drawback of using query business rule instead of ACL ?