Tips and tricks¶
Convert Salesforce IDs¶
Each record in Salesforce can be identified with an unique id - of which two versions exist: One (case-sensitive) with 15-characters and one (case-insensitive) with 18-characters.
Excel¶
gammone.com describes the algorithm to convert a 15-character ID into its 18-character equivalent. It also provides code implementations for different languages - a.o. Visual Basic for Applications (VBA):
Function FixID(InID As String) As String
If Len(InID) = 18 Then
FixID = InID
Exit Function
End If
Dim InChars As String, InI As Integer, InUpper As String
Dim InCnt As Integer
InChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345"
InUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
InCnt = 0
For InI = 15 To 1 Step -1
InCnt = 2 * InCnt + Sgn(InStr(1, InUpper, Mid(InID, InI, 1), vbBinaryCompare))
If InI Mod 5 = 1 Then
FixID = Mid(InChars, InCnt + 1, 1) + FixID
InCnt = 0
End If
Next InI
FixID = InID + FixID
End Function
This code allows you to get an Excel-function (in your current workbook) to do the conversion.
Excel formula
The page also provides an Excel formula - but at least for me it did not work.
Add VBA code to Excel
- Press Alt+F11 to open the VBA Editor
- Right click on VBAProject (left side of the screen) ➡️ Insert ➡️ Module
- Copy & Paste the VBA code
- Now you have a new Excel function (
=FixID()) available to perform the conversion
Browser¶
The bookmarklet described on Salesforce Help converts a single ID. Add a bookmark in your browser and enter the following code as URL:
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);
})();
Mass-upload attachments¶
To attach a lot of files to a lot of records, you need to clarify whether they should be uploaded as attachments or files. The difference is described on dataimporter.io (tl;dr: Files are the modern solution). The easiest way is to check which related list is on the record page layout.
- Attachments are uploaded into the
Attachmentobject - Files are uploaded into the
ContentVersionobject and related through theContentDocumentLinkobject
Tools¶
- Salesforce Data Loader: Mass update data using CSV files
- Salesforce Inspector reloaded: This browser add-on is like the Swiss Army Knife for Salesforce
- Workbench: Web interface for various API functionalities
URL Hacks¶
Functionality and tricks based on opening a specific URL in the browser. Keep in mind to replace the <YourDomain> part.
Reset security token¶
If the option to reset your security token is not available in your settings (e.g. in a Sandbox).
https://<YourDomain>.lightning.force.com/_ui/system/security/ResetApiTokenEdit?retURL=%2Fui%2Fsetup%2FSetup%3Fsetupid%3DPersonalInfo&setupid=ResetApiToken
Bypass New-button override¶
If the "New" button of a specific object (e. g. Accounts) is overridden (e.g. with a Visualforce Page) and you want to use the standard record creation screen. More URL Hacks on record creation can be found in Shivam Vishwakarma's article.
https://<YourDomain>.lightning.force.com/lightning/o/Account/new?nooverride=1