- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 06:44 AM
Hi all,
I need to identify the requester company to hide/ show specific fields. I´ve been trying with a client script and script include, but when I load the form a javascript appears. ' TypeError: Cannot read property 'initialize' of undefined'
Client Script:
function onLoad() {
//Type appropriate comment here, and begin script below
var ga = GlideAjax('GetUserCompany');
ga.addParam('sysparm_name','getComp');
ga.getXML(fulfillParse);
function fulfillParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('company', answer);
}}
Script includes:
var GetUserCompany = Class.create();
GetUserCompany.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getComp: function() {
return gs.getUser().getCompanyID(); //returns sys id of an company to client script as an answer
}
});
Any advice will be helpful.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 11:38 AM
Oh, meant to say the problem you are having is you are missing the "new" keyword:
var ga = new GlideAjax('GetUserCompany');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2019 12:11 PM
I know: sometimes it's the simplest of things. I've banged my head on a wall a lot because of slight typos. Especially case-sensitive things.