Comments on: Leveraging User Criteria in your custom applications https://servicenowguru.com/scripting/leveraging-user-criteria-custom-applications/ ServiceNow Consulting Scripting Administration Development Sat, 15 Jun 2024 11:39:38 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Jacob Kimball https://servicenowguru.com/scripting/leveraging-user-criteria-custom-applications/#comment-10061 Sat, 15 Jun 2024 11:39:38 +0000 https://servicenowguru.com/?p=15374#comment-10061 In reply to Mike Moody.

Weird. I haven’t noticed that before but will see if I can reproduce when I have a moment. Thanks for the comment!

]]>
By: Mike Moody https://servicenowguru.com/scripting/leveraging-user-criteria-custom-applications/#comment-10060 Sat, 15 Jun 2024 05:38:36 +0000 https://servicenowguru.com/?p=15374#comment-10060 One annoying discovery I made related to UCs used on KB articles, at least in our Vancouver instances, is that the UC doesn’t seem to work unless it is also related to at least one catalog item. Maybe there built in evaluation that is leveraged by the KB security evaluation is coupled to some code pertinent to catalog items that is checking that m2m table for a record tied to the UC. Great article

]]>
By: Jacob Kimball https://servicenowguru.com/scripting/leveraging-user-criteria-custom-applications/#comment-10049 Tue, 11 Jun 2024 11:42:24 +0000 https://servicenowguru.com/?p=15374#comment-10049 In reply to Dorian.

Absolutley! We had the m2m use case for what we implemented so we built that wrapper to create the needed array of UC’s from that data model. If you just need to pass in a UC you could use _matchesUCList() directly. The “_” prepending the function name is typically used to indicate a function intended for internal use only (by other functions in that object)…but that is just a convention, so you could use it directly as-is or rename it to remove the “_” (and make the updates throughout the rest of the code) and use it that way. Thanks for your comments!

]]>
By: Jacob Kimball https://servicenowguru.com/scripting/leveraging-user-criteria-custom-applications/#comment-10048 Tue, 11 Jun 2024 11:36:46 +0000 https://servicenowguru.com/?p=15374#comment-10048 In reply to Dorian.

Thanks for catching this Dorian! I believe I’ve fixed them, but let me know if you see anything else askew!

]]>
By: Dorian https://servicenowguru.com/scripting/leveraging-user-criteria-custom-applications/#comment-10047 Tue, 11 Jun 2024 10:52:44 +0000 https://servicenowguru.com/?p=15374#comment-10047 Great article! Love the knowledge sharing.

Question: So this wrapper currently makes an assumption that you need to have another custom table that holds the m2m data right? I wonder if you can skip the idea of having an extra table to hold that and just pass in an existing User Criteria.

So for example:
In KB you have the “Can Read” where you add all the UCs that “Can Read”.

What if you just had a function that takes in a given UC record, evaluates if the user matches thes the criteria. That would save you from having to create m2m tables right? In cases where you need more than 1 UC to be evaluated, you just loop through the function you created and return true if any match.

]]>
By: Dorian https://servicenowguru.com/scripting/leveraging-user-criteria-custom-applications/#comment-10046 Tue, 11 Jun 2024 10:46:32 +0000 https://servicenowguru.com/?p=15374#comment-10046 I think you have a small typo:

On line 94 “this._matchesList(ucArray, emptyListReturn);”
On line 110: “return this.matchesList(ucArrayofOne, false);”,

I believe that you renamed the function to “_matchesUCList” so those function calls need to be renamed.

]]>