onSubmit script error: ReferenceError: func is not defined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2019 08:08 AM
I have a huge issue on my hands (see details below):
When I select the "New Hire" radio button and select order now, the order now button does not work. When the other 2 choices are selected, the order now button works just fine. But when in the service portal view it works flawlessly no matter what radion button is selected. Does anyone have any leads as to why this is not working outside of the service portal?
There are 2 onSubmit scripts:
1. One to populate the visible variable list
2. And this one below:
function onSubmit() {
if (g_form.getValue('employee_type') == 'New Hire') {
//check to see if user is already in sys_user
var uua = new GlideAjax('u_UserUtilsAjax');
uua.addParam('sysparm_name', 'findUser');
uua.addParam('sysparm_identifier', g_form.getValue('vs_new_hire_user_id'));
uua.getXML(uuaCallback);
if ((answer != null) && (answer != '')) {
//"new user" exists in sys_user so set the requested for to the new hire
var cua = new GlideAjax('u_CartUtilsAjax');
cua.addParam('sysparm_name', 'setCartRequestedFor');
cua.addParam('sysparm_userId', g_user.userID);
cua.addParam('sysparm_reqForId', answer);
cua.getXML(cuaCallback);
} else {
//for "new users" not in sys_user, set requested for to the manager indicated by the user
var cua = new GlideAjax('u_CartUtilsAjax');
cua.addParam('sysparm_name', 'setCartRequestedFor');
cua.addParam('sysparm_userId', g_user.userID);
cua.addParam('sysparm_reqForId', g_form.getValue('vs_new_hire_hiring_manager'));
cua.getXML(cuaCallback);
}
} else {
//for "current employee" and "dept. transfer", set requested for to the normal default of the current user
//otherwise it may show a requested for from a previous "new user" incomplete order
var cua = new GlideAjax('u_CartUtilsAjax');
cua.addParam('sysparm_name', 'setCartRequestedFor');
cua.addParam('sysparm_userId', g_user.userID);
cua.addParam('sysparm_reqForId', g_user.userID);
cua.getXML(cuaCallback);
}
function uuaCallback(response){
var answer = response.responseXML.documentElement.getAttribute("uu");
}
function cuaCallback(response){
var answer = response.responseXML.documentElement.getAttribute("cu");
}
}
Any tips would be greatly appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2019 06:16 AM
Hello dvp thanks for the reply,
The overall requirement is to fix the catalog item so that it can go through to form submission. This catalog items was built some time ago and i am new to the scene. As for the uu and cc attributes I am not sure if they have been defined server side or not.
The goal is not to stop form submission whatsoever. This catalog item has been working just fine up until about a few weeks about when we upgraded some of our lower environments to London.
The purpose of the scrip is to set the cart requested for, with new user(s). The new hire option is the only option that causes an issue with form submission.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2019 10:46 PM
Uncheck Isolate Script checkbox.