The CreatorCon Call for Content is officially open! Get started here.

UI Page Glide

joeowen
Kilo Explorer

I am currently using a UI Page to hold a form in which values are passed. The UI Page that I am using is public as it is like a support system so people do not have to login. When using new GlideRecord in the client script it seems like it is not allowing public users to get information from the system. An example of this is that I am using dropdown boxes for categories and then populating a sub-category dropdown depending on the category etc. I have tried making the ACL read for the cat and sub-cat tables public but it is also having problems. Here is the snippet of the code I am using. When I am logged in by the way the fields populate perfectly.

function updateSubCat(elem) {

            var optionValue = elem.options[elem.selectedIndex].value; // Gets the sys_id selected category

            removeOptions(); // Removes existing sub-category options

            var item = new GlideRecord('u_sub_categories'); // Creates a new glide record for u_sub_categories

            item.addQuery('u_parent', optionValue); // Adds the sys_id of the selected category to the query as parent

            item.orderBy('u_sub_category'); // Order the results by sub-category

            item.query(); // query the record

            // Loop through each record and add to the dropdown list

            while(item.next()){

                      var y = document.getElementById("u_sub_category"); // Gets the sub-category dropdown

                      var yoption = document.createElement("option"); // Creates an option for the dropdown

                      yoption.text = item.u_sub_category; // Sets the display value to the sub-category

                      yoption.value = item.sys_id; // Sets the value of the field to the sys_id of the category

                      y.add(yoption); // Adds the option to the list

}                            

            // Checks whether the value is equal to the sys_id of the category Other

            if(optionValue == "12719803994a31007f448829d69a5701"){

                      document.getElementById("tbl_sub_cat").style.display = "none"; // If yes it will hide the sub-category field

                      var y = document.getElementById("u_sub_category"); // Finds the select element for sub-category

                      y[0].setAttribute("selected","selected"); // Sets the default selected to the "Other" sub-category

            } else {

                      document.getElementById("tbl_sub_cat").style.display = "inline"; // If it is not it will set the field to be displayed.

            }

}

I am also having a problem submitting the data into a table. Any help would be greatly appreciated.

11 REPLIES 11

This script include does not work for me..


Why always answer is null?