Description
Reference qualifier on a variable for a record producer in CMS calling a script include does not work for non-logged in users.
When a non-logged in user clicks on a reference field that contains this reference qualifier, it returns with a blank pop-up page.
If the same reference qualifier is used on a normal form field, it works properly.
Steps to Reproduce
- Navigate to a catalog item that is already present on OOB /ess site (for example, Something Broken)
- Make this catalog item public by adding the public role on the Roles field
- Open up the variable of this catalog item named caller_id and put the public role to Read roles, Write roles, and Create roles
- Now this variable is referencing sys_user, so create a table read ACL on sys_user to allow public user access
- Navigate to sys_public.list and add in the pages: sys_user and sys_user_list (so public users can access those pages)
- Create a script include to be used for an advanced ref qual on this variable. The script include can have one function that returns gs.log()
- On the variable advanced ref qual, call this script include Javascript: new MySI().myFoo();
- While not logged in, navigate to /ess and to that record producer
- If everything is done/set up correctly at to this point, as a non-logged in user you should be able to access the record producer on ess and see the reference variable
- Click on the reference variable: a blank pop-up page appears
Error on the logs:
null:357:626: <g2:list_record_sys_ref_list> java.lang.NullPointerException: java.lang.NullPointerException: com.glide.processors.xmlhttp.LightweightReferenceUtil.addQuestionReference(LightweightReferenceUtil.java:267)
com.glide.list_v2.ListRecordSysRefListTag.isLightweightReference(ListRecordSysRefListTag.java:149)
com.glide.list_v2.ListRecordSysRefListTag.initAdditionalQuery(ListRecordSysRefListTag.java:95)
com.glide.list_v2.ListRecordDefaultTag.doTag(ListRecordDefaultTag.java:75)
org.apache.commons.jelly.impl.TagScript.run(TagScript.java:299)
org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:146)
org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:232)
org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:111)
org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:94)
org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:146)
org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:232)
org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:111)
org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:94)
org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:146)
org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:232)
org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:111)
org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:94)
org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:146)
org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:232)
org.apache.commons.jelly.tags.core.JellyTag.doTag(JellyTag.java:84)
org.apache.commons.jelly.impl.TagScript.run(TagScript.java:299)
com.glide.ui.jelly.GlideJellyContext.run(GlideJellyContext.java:600)
com.glide.ui.jelly.GlideJellyContext.executeCompiledScript(GlideJellyContext.java:802)
com.glide.ui.GlideFormPhase2.generate(GlideFormPhase2.java:51)
com.glide.ui.GlideForm.generatePopulatedForm(GlideForm.java:637)
com.glide.ui.GlideForm.quickExit(GlideForm.java:263)
com.glide.ui.GlideForm.getRenderedPage(GlideForm.java:177)
com.glide.ui.NavigationTransaction.writeOutput(NavigationTransaction.java:156)
com.glide.ui.NavigationTransaction.process(NavigationTransaction.java:127)
com.glide.ui.GlideServletUITransaction.process(GlideServletUITransaction.java:83)
com.glide.processors.Processor.runProcessor(Processor.java:402)
com.glide.processors.Processor.processTransaction(Processor.java:192)
com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:146)
com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:36)
com.glide.ui.GlideServlet$1.run(GlideServlet.java:414)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
java.lang.Thread.run(Thread.java:682) - Follow these same steps as a logged-in user and note that it works as expected
*Important: This only happens for a variable on a record producer for CMS. If the same ref qual is used on a normal reference form field, it works for non-logged in users and no errors occur.
Workaround
- Adding a Property glide.script.ccsi.ispublic. This property changes the visibility of client-callable script includes by making them all public or private. Configure the property as follows:
- Name: glide.script.ccsi.ispublic
- Type: true|false
- Value: false
- Add the following method to the script include FormStateAjax:
isPublic: function() {
return true;
},
Related Problem: PRB667204