2

I am receiving this javascript error in an up-to-date version of Google Chrome (Version 45.0.2454.101 m):

    error: 
    {faultcode:'soapenv:Client', faultstring:'Attribute "xmlns" bound to namespace 
"http://www.w3.org/2000/xmlns/" was already specified for element "query".',}

this is the error message as it appears on the page

I know this question has already been asked, but I wanted to bump this because the solution back in 2013 was to not use IE 8.0, or to use chrome frame.

After opening up the dev console I see the standard .../logo180 error (used for malware checking) but I also see the details causing the above error:

POST https://na20.salesforce.com/services/Soap/u/7.0 500 (Server Error)
send @ connection.js:679
sforce.SoapTransport.send @ connection.js:1065
sforce.Connection._invoke @ connection.js:1588
sforce.Connection.invoke @ connection.js:1531
sforce.Connection.query @ connection.js:1287
AutoComplete.query @ main.js:341
AutoComplete.doLookup @ main.js:327
AutoComplete.onKeyUp @ main.js:335
(anonymous function) @ VM2303:1

Followed by:

Uncaught TypeError: Cannot read property 'records' of undefined
AutoComplete.doLookup @ main.js:327
AutoComplete.onKeyUp @ main.js:335
(anonymous function) @ VM2303:1

Someone in my office said we used to have a package installed that did an autocomplete when filling out a lookup field...however we have no package installed. Any ideas on how to fix this error?

Edit #2: We do have "ActionPlans" installed as an unmanaged package (not the most recent v3 which is managed) which comes with a lot of javascript static resources. Perhaps the error comes from here? https://github.com/ForceDotComLabs/ActionPlans/tree/master/src/staticresources

Edit #3: The autocomplete function seems to reside in Salesforce's 'main.js' file...I'm severely confused.

Edit #4: The offending JS lines?

AutoComplete.prototype.highlightMatch=function(a,d){if(!a||!d)return"";var b=a.toLowerCase(),c=d.toLowerCase(),e=b.indexOf(c);if(-1==e)return a;b=a.substring(0,e);c=a.substring(e,e+d.length);e=a.substring(e+d.length);return b+"\x3cb\x3e"+c+"\x3c/b\x3e"+e};AutoComplete.prototype.doFilter=function(a){for(var d=[],b=0;b<this.records.length;b++){var c=this.records[b];this.isMatch(c,a)&&d.push(c)}d&&0<d.length?this.displayResults(d,a):this.doClear()};
AutoComplete.prototype.isMatch=function(a,d){var b=null;return(b=1==this.entityNameFields.length?a.get(this.entityNameFields[0]):this.getName(a))&&-1<b.toLowerCase().indexOf(d.toLowerCase())};AutoComplete.prototype.doClear=function(){this.displaySuggestions(!1);this.selected=-1};AutoComplete.prototype.displaySuggestions=function(a){AutoComplete.prototype.showBox(this.getBaseName(),a)};
AutoComplete.prototype.selectItem=function(a){var d=this.getBaseName(),b=null,c=null,e=AutoComplete.prototype.getBox(d);if(e&&0<=a&&(e=e.childNodes[0].childNodes[0])&&e.rows&&a<e.rows.length)if(a=e.rows[a])if(a=a.cells[0].getElementsByTagName("div")[0])b=a.id;if(b)for(a=0;a<this.records.length;a++)if(e=this.records[a],b==ApiUtils.getId(e)){c=this.getName(e);break}b&&c&&lookupPick(AutoComplete.prototype.FORM_NAME,d+"_lkid",d,"",b,c,"","");(d=AutoComplete.prototype.AUTOCOMPLETE_MAP[d])&&d.doClear()};
AutoComplete.prototype.onKeyUp=function(a){a||(a=window.event);var d=AutoComplete.prototype.AUTOCOMPLETE_MAP[this.name];if(d){var b=this.value,c=a&&a.keyCode;if(!AutoComplete.prototype.IS_PROCESSING&&(!c||!AutoComplete.prototype.isEnter(a)))if(c&&AutoComplete.prototype.isNavigation(a))AutoComplete.prototype.handleNav(this.name,a);else if(!c||!AutoComplete.prototype.isTypingFast(this.name,a))if(!c||!AutoComplete.prototype.isIgnore(a))if(c&&AutoComplete.prototype.isEscape(a))d.doClear();else if(null!=
b&&b.length>=AutoComplete.prototype.MIN_LENGTH_THRESHOLD)null==d.valQueried||-1==b.toLowerCase().indexOf(d.valQueried.toLowerCase())?d.doLookup(b):d.doFilter(b);else if(null==b||b.length<=AutoComplete.prototype.MIN_LENGTH_THRESHOLD)d.valQueried=null,d.doClear()}};AutoComplete.prototype.onFocus=function(a){if(a=AutoComplete.prototype.AUTOCOMPLETE_MAP[this.name])a.hasFocus=!0};
AutoComplete.prototype.onBlur=function(a){a||(a=window.event);var d=AutoComplete.prototype.AUTOCOMPLETE_MAP[this.name];d&&(d.hasFocus=!1,AutoComplete.prototype.TIMEOUT_ID&&clearTimeout(AutoComplete.prototype.TIMEOUT_ID),a&&!AutoComplete.prototype.isIgnore(a)&&!AutoComplete.prototype.isEscape(a)&&0<=d.selected?d.selectItem(d.selected):setTimeout("AutoComplete.prototype.AUTOCOMPLETE_MAP['"+this.name+"'].doClear()",200))};
AutoComplete.prototype.setSelected=function(a,d){var b=AutoComplete.prototype.AUTOCOMPLETE_MAP[a];b&&(b.selected=d)};
AutoComplete.prototype.handleNav=function(a,d){var b=AutoComplete.prototype.AUTOCOMPLETE_MAP[a];if(b){var c=40==d.keyCode,e=b.selected,f=AutoComplete.prototype.getBox(b.getBaseName());if(f&&(f=f.childNodes[0].childNodes[0])&&f.rows){c?b.selected<f.rows.length-1&&e++:0<b.selected&&e--;if(0<=b.selected&&(c=f.rows[b.selected])&&c.childNodes[0])c.childNodes[0].onmouseout();if(0<=e){if((c=f.rows[e])&&c.childNodes[0])c.childNodes[0].onmouseover();b.selected=e}}}};AutoComplete.prototype.LAST_DATE=null;
AutoComplete.prototype.TIMEOUT_ID=null;
AutoComplete.prototype.isTypingFast=function(a,d){AutoComplete.prototype.TIMEOUT_ID&&clearTimeout(AutoComplete.prototype.TIMEOUT_ID);var b=new Date;if(null==AutoComplete.prototype.LAST_DATE)return AutoComplete.prototype.LAST_DATE=b,!0;var c=b.getTime()-AutoComplete.prototype.LAST_DATE.getTime();AutoComplete.prototype.LAST_DATE=b;return c<AutoComplete.prototype.TYPING_THRESHOLD_MILLIS?(AutoComplete.prototype.TIMEOUT_ID=setTimeout("document.getElementById('"+a+"').onkeyup();",AutoComplete.prototype.TYPING_THRESHOLD_MILLIS),
!0):!1};AutoComplete.prototype.isNavigation=function(a){a=a.keyCode;return 38==a||40==a};AutoComplete.prototype.isIgnore=function(a){a=a.keyCode;return 9==a||16==a||33<=a&&46>=a||112<=a&&123>=a};AutoComplete.prototype.isEscape=function(a){return 27==a.keyCode};AutoComplete.prototype.isEnter=function(a){return 13==a.keyCode};AutoComplete.prototype.query=function(a){try{var d=sforce.connection.query(a);a={};a.size=d.size;a.records=d.getArray("records");return a}catch(b){alert("error: "+b)}};
AutoComplete.prototype.makeBox=function(a,d,b){if(AutoComplete.prototype.IS_IE)
1

So, take this with as much salt as you have handy. I've not had time to dig into this because I can't readily reproduce it. That said, I've often come across this portion of your error: Uncaught TypeError: Cannot read property 'records' of undefined and it almost always flows from a malformed query. I wonder if you couldn't capture the queries being sent with Chrome's dev tools to identify the query that was causing the issue and work backwards from there.

If it is some kind of autocomplete failing, you should be able to enter a unique string ... somewhere... and use that unique string to identify the query being made with it, from there see what objects are being queried, and even run the query in the SF Dev console. It might highlight an outdated script from a managed package or unmanaged code.

Again, I can't easily reproduce this, so I don't have a solid solution, just some debugging tips.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.