- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 06:25 AM
I'm trying to make a ui policy where some fields becomes read only if the user isnt a "manager" on the knowledge base that the article is connected to.
I'm doing like the picture below, but can't get it to work, no idea why.
If I try this script in script-background it works as a charm.
var gr = new GlideRecord('kb_knowledge_base');
gr.addQuery('kb_managers','DOES NOT CONTAIN',gs.getUserID());
gr.query();
while(gr.next()){
gs.log("KB Base " + gr.title + " doesn't have your sys_id as manager");
}
Any clues?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 07:34 AM
There was an problem long back when the conditions of UI policy with fields would not work, unless it was added on the form layout. Not sure if this is related to that problem.
But please modify the form layout, dot walk the knowledge base field and add the manager list field to the layout. That would make the UI policy work

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 06:29 AM
Did you try 'is not' instead of 'does not contain'?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 06:42 AM
"is not" isnt a option ... got "does not contain", "contains", "is empty" & "is not empty".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 06:48 AM
gs.getUserID function returns the sys_id of the user. try getting the sys_id of the manager- like
Knowledge base.managers.sys_id does not contain gs.getUserID()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2016 07:01 AM
Ahhh...sorry, didn't realize that was a list item.
Actually looking at this myself, I now see what you are saying. Dot-walking to this field from the article, the javascript does not appear to be evaluated. If I do a similar UI policy at the Knowedge base level itself against the managers field, that works, but dot walking it from the article in the condition builder it is not.