Search Here

How do you convert 15 digit record Id to 18 digit Id in formula and validation rule in java

 



3. Build Your Own Code

Javascript Browser Bookmarklet is another recommendation by Salesforce to convert IDs manually. 

Add this Javascript as a bookmarklet in your browser, and you’ll be able to convert IDs with just the flick of your finger. But this might not work in Microsoft Edge.

  1. Create a new bookmark and name it.
  2. Add the code below the URL.
  3. Save the bookmark.

Code:

javascript:(function(){

var input=prompt(‘Enter 15-character ID’);

var output;

                   if(input.length == 15){

                                      var addon=””;

                                      for(var block=0;block<3; block++)

                                      {

                                          var loop=0;

                                                  for(var position=0;position<5;position++){

                                                      var current=input.charAt(block*5+position);

                                                          if(current>=”A” && current<=”Z”)

                                                             loop+=1<<position;

                                                       }

                   addon+=”ABCDEFGHIJKLMNOPQRSTUVWXYZ012345″.charAt(loop);

                                      }

                                      output=(input+addon);

                   }

                   else{

                                      alert(“Error : “+input+” isn’t 15 characters (“+input.length+”)”);

                                      return;

                   }

prompt(’18-character ID:’,output);

})();

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.