- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Issue:
In Madrid Patch 8, Newyork Patch 2 & Orlando after evaluating the Scripted User Criteria differently and customers who have function such as ‘function answer()’ will face access issues on Service Catalog. We see issue such as ‘cannot read = true' re-set to false, enabling users to see certain items they should not see. This will be a continued access failure and not an intermittent situation.
There are possibly some of customers who are declaring ‘answer’ as javascript function in their User Criteria scripts. This new evaluation assumes ‘answer’ to be a reserved variable. This variable can be set to a value and that value is then treated as the result of the script evaluation. However if a customer declares a function with name ‘answer’ then they will not have the desired results. This breaks in ACL Script, BR Script, Email Script and almost every place where we can script. User Criteria Script would also be breaking now, as it now uses the same platform API to evaluate scripts.
Important points about the Script:
• The script is evaluated in the scope that the user criteria is created in.
• The evaluation of the script is cached in the session, so any change in the evaluation requires you to logout and login, similar to roles in ACL.
• Do not use gs.getUser() or other session APIs since they cause conflict when used in diagnostic tools. Use the pre-defined user_id variable available in the script to get the user id of the user being used to evaluate the script.
• Because scripts are evaluated dynamically, including scripts in user criteria records can decrease performance.
• Also make sure that the script does not define a function with the name 'answer'. The new process of evaluating the scripts in scope requires 'answer' to be treated as a reserved variable which you can use to set the result of your business logic. In case the script does not set the 'answer' variable to a value, the return value of script is treated as the result. Declaring a function like- function answer() { // code goes here}
Important KB article KB0780873 related with above issues you can find below
Related PRB
PRB1380636: User criteria script ignores a function with answer as name in NY Patch 4 (in-branch regression from NY Patch 1)
Expected behavior
The widget should be displayed
Actual behavior
The widget is not displayed. The answer function is not evaluated and the user criteria evaluates to false.
If you change the script to: return true;
Workaround:
Do not use a function with its name as answer, that is, answer().
Important Links:
How to create a user criteria record to define conditions that are evaluated against user records can be found in this document.
- 1,003 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.