Dynamic User Criteria

stevejarman
Tera Guru

Is it possible to reference "current" in a User Criteria advanced script? i.e. the record against which the User Criteria is being evaluated?

I want to set the "Can Contribute" on a Knowledge Base to be the users already defined as the Managers (kb_managers) on the Knowledge Base record. I've created a User Criteria with the following code (below). But it doesn't seem to work - I still find that EVERYONE can contribute.

answer();

function answer() {
  return (current.kb_managers.toString().indexOf(gs.getUserID()) != -1);
}
3 REPLIES 3

stevejarman
Tera Guru

A couple of screenshots:

find_real_file.png

 

find_real_file.png

SanjivMeher
Mega Patron

I dont think you can do that using user criteria. You will need an ACL for this.

PriyankaC
Tera Expert

This is a good question! Because User criteria are evaluated dynamically, you could define a Glide Record query in your answer() function that looks for Knowledge bases that match the condition. 

I haven't tested to see if this works. If it does, i would love to know!

Thanks,

Priyanka