You need to sign in to do that
Don't have an account?
Harmpie
Merge fields and Id's
I am running into a problem using an Apexchange application FTP attachments pro. This application requires to set up custom links that embed the record Id. Using merge fields, the 15 character Id is returned, however, the application requires the 18 character Id to be passed (using a case insensitive FTP server)! Is there a way to convert the 15 char Id within the custom link to the 18 char variant ?
As you can see, it takes a 15bit Id and returns and 18bit version....
Actually, I found another version of it that seems to work perfectly:
function normaliseSforceID( id) { // fluff up a 15 char id to return an 18 char id
if (id == null) return id;
id = id.replace(/\"/g, ''); // scrub quotes from this id
if (id.length != 15) {
//print('well, id is not 15, bye' + id + ' ' + id.length);
return null;
}
var suffix = "";
for (var i = 0; i < 3; i++) {
var flags = 0;
for (var j = 0; j < 5; j++) {
var c = id.charAt(i * 5 + j);
if (c >= 'A' && c <= 'Z') {
flags += 1 << j;
}
}
if (flags <= 25) {
suffix += "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(flags);
} else {
suffix += "012345".charAt(flags-26);
}
}
return id + suffix;
}