How to remove 'Number of rows removed from this list' message by writing query business rule on Knowledge Article table table.?

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Customer wants us to remove 'Number of rows removed from this list' message from Knowledge article table hence I read somewhere that we have to write query business rule, I tried writing one sample query business rule but that message is not going, Can someone please help me with that.

Regards,

Musab

Please hit like and mark my response as correct if that helps
Regards,
Musab
1 ACCEPTED SOLUTION

Musab Rasheed
Tera Sage
Tera Sage

This is done successfully with query BR.

 

(function executeRule(current, previous) {
  var allowedIds = [];

  var kb = new GlideRecord('kb_knowledge');

  kb.query();

  while (kb.next()) {
    if (kb.canRead()) {
      allowedIds.push(kb.getUniqueValue());
    }
  }

  current.addEncodedQuery('sys_idIN' + allowedIds);
})(current, previous);
Please hit like and mark my response as correct if that helps
Regards,
Musab

View solution in original post

7 REPLIES 7

Murthy Ch
Giga Sage

@Musab Rasheed 

It is happening because of ACL'S on the table.

If you don't want that message to be displayed, you can write query BR with same configuration.

 

Thanks,

Murthy

Thanks,
Murthy

I know I have to write BR but when I'm replacing ACL code in BR it is not displaying even a single record and just displaying security message .

 

ACL Code which i disabled : answer = new global.KBScopedKnowledgeSNC().canReadArticle(current);

 

BR Code : // if(new global.KBScopedKnowledgeSNC().canReadArticle(current));
// {
// current.addEncodedQuery('sys_class_name!=kb_knowledge_block^kb_knowledge_base=bb0370019f22120047a2d126c42e7073^workflow_state=published');
// }

Please hit like and mark my response as correct if that helps
Regards,
Musab

Vaishnavi Lathk
Mega Sage
Mega Sage

Hello,

This message is very annoying.

It can be removed by effectively duplicating your ACL logic in your Before Query Business Rules.

find_real_file.png

Surely there is an easier way?!

There is a very simple way to get rid of the message for all users on all tables
This is an all or nothing solution.

Also, the pagination will still show the total number of records including ones you do not have access to.

On the Message table [sys_ui_message], search for key="Number of rows removed from this list by Security constraints: {0}".

Then, set the Message field to be one empty space.

find_real_file.png

And the message is gone!

find_real_file.png

You may also want to consider doing this for "Number of rows removed by Security constraints: {0}" UI Message.

An alternative would be to create a new Message of that key in your Language and do the same.

 

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.

Regards,

Vaishnavi

 

Hello @Vaishnavi Lathkar ,

I'm aware about this as well thanks for the reminder though but I want to achieve this via BR , I'm writing below code which I copied from ACL but it is not working, let me know what wrong I'm doing. Screenshots are as follows.

 

ACL screenshot : 

find_real_file.png

 

BR Screenshot:

find_real_file.png

 

Error Screenshot:

 

Please hit like and mark my response as correct if that helps
Regards,
Musab