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

Hi



I tried keeping below function in the script include but it doesn't work :


isPublic: function() {


    return true;


  },


syed_faheem
ServiceNow Employee
ServiceNow Employee

Hi Sharad,



Try assigning public role to the read ACL of the table you are accessing.



Cheers


Syed


Hi Syed



I have made the table access public and performing insert operation on it but it is not working.



Please find the snap below :



find_real_file.png


Is this the same thing, you wanted me to do ?


syed_faheem
ServiceNow Employee
ServiceNow Employee

Hi Sharad,



What error you are receiving ? is you UI page set to public ?



If you can share the code where you are inserting record that will be more helpful.



Cheers


Syed.


Hi Syed



The insert table operation works now from a public UI page. Thanks a lot for your help.



However , the associated workflow with that is not running. If you have any idea about this, kindly help me out.