You need to sign in to do that
Don't have an account?
get body of large text fields
I had to write this today, may be usefull to others
I used this to fetch the body of large text fields which contain data greater than 4096 bytes.
Code:
I used this to fetch the body of large text fields which contain data greater than 4096 bytes.
Code:
Sforce.Dynabean.prototype.getLargeText = function(propName) { // like get(), but will unpack document body elements which are greater than 4096... var body=''; try { var tmp = this.getItem(propName).value; // still could return a null, watch for that when calling if ( Sforce.Util.dltypeof(tmp) == "domelement" ) { // see what type of object tmp is... for (var i=0; i < tmp.childNodes.length; i++) { body += tmp.childNodes[i].textContent; } } else { // normal string if body is < 4096 bytes body = tmp; } } catch (e) { throw(e); } return body; };
However, I think I found a cleaner fix, something that perhaps should be incorporated into the sforceclient.js file during it's next update cycle.
It's a small change to the ParseVal function which preserves the .get() functionality, as well as re-balancing the Base 64 stuff which is unbalanced in the current API. (in the sense that you have to decode it, but not encode it.)
Please refer to thread:
http://forums.sforce.com/sforce/board/message?board.id=general_development&message.id=6336
For the code fix. (obviously, if you didn't want ParseVal to undo the Base64 stuff, you can just treat it as a 'textarea' object.)
Thanks, Steve.
Any plans for a Beta 3.4 anytime soon? There are a number of code fixes outstanding. :-)