getting ReferenceError: g_list is not defined for UI action (Helsinki)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2017 03:28 PM
I have created 2 separate UI actions one on change_request table (form UI action) and the other one on sysapproval_approvers (List choice UI action); also, I created a script include for my list choice UI action, but when I click on my form UI action it doesn't work and my browser console goves me the error ReferenceError: g_list is not defined. Please advise.
Form UI action ( client callable)
function rejectTicket(){
var answer=confirm("Are you sure you want to reject this change?");
if(answer == false){
return false;
}
else if (answer == true) {
if(g_form.getValue('work_notes')=='')
{
g_form.setMandatory('work_notes',true);
alert(getMessage('Please fill out the reject reason in notes section'));
}
else
{
gsftSubmit(null, g_form.getFormElement(), 'reject_change');
}
}}
if(typeof window == 'undefined')
runCode();
function runCode(){
reject();
}
function reject(){
var myApp = new ChangeApprovalUtils().checkMyApprovals(current.sys_id);
var appRec = new GlideRecord('sysapproval_approver');
appRec.addQuery('sys_id',myApp);
appRec.query();
if (appRec.next()){
appRec.state = 'rejected';
appRec.update();}}
List choice UI action ( client callable)
function rejectTicket(){
var answer=confirm("Are you sure you want to reject this record?");
if(answer == false){
return true; }
var ids = g_list.getChecked();
var aj = new GlideAjax('reject_change');
aj.addParam('sysparm_name', 'doit');
aj.addParam('sysparm_ids', ids);
aj.getXML(function(answer){
location.reload();
});
}
Script include for list choice ( client callable)
var reject_change = Class.create();
reject_change.prototype = Object.extendsObject(AbstractAjaxProcessor, {
doit: function () {
var ids = this.getParameter('sysparm_ids');
ids = ids.split(',');
for (var i = 0, il = ids.length; i < il; ++i) {
var gr = new GlideRecord ('sysapproval_approver');
gr.get (ids[i]);
gr.state = 'rejected';
gr.update();
}
},
type: 'reject_change'
});
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 03:52 PM
Hi Eliana,
I'm missing some information here, but it sounds like what's going on here is that some component on your form is causing the client to crash. Does the g_list error appear only once you press the Form UI action or as soon as the form loads? Does the error in the client log persist if you disable loading related lists on form load? If not does that resolve the button press?
Thanks,
Gustavo Garcia