Showing posts with label salesforce id. Show all posts
Showing posts with label salesforce id. Show all posts

Tuesday, 29 September 2015

Difference in ISNULL and ISBLANK

ISNULL:

  •  Determines if an expression is null (blank) and returns TRUE if it is. If it contains a value, this function returns FALSE.
  • Text fields are never null, so using this function with a text field always returns false. For example, the formula field IF(ISNULL(new__c) 1, 0) is always zero regardless of the value in the New field. For text fields, use the ISBLANK function instead. 
  • Multi-select picklist fields are never null in s-controls, buttons, and email templates, so using this function with a multi-select picklist field in those contexts always returns false.
  • Empty date and date/time fields always return true when referenced in ISNULL functions.
  • Choose Treat blank fields as blanks for your formula when referencing a number, percent, or currency field in an ISNULL function. Choosing Treat blank fields as zeroes gives blank fields the value of zero so none of them will be null. 
  • Merge fields can be handled as blanks, which can affect the results of components like scontrols because they can call this function.
  • When using a validation rule to ensure that a number field contains a specific value, use the ISNULL function to include fields that do not contain any value. For example, to validate that a custom field contains a value of ’1,’ use the following validation rule to display an error if the field is blank or any other number: OR (ISNULL(field__c), field__c<>1)

ISBLANK:


  • Determines if an expression has a value and returns TRUE if it does not. If it contains a 
    value, this function returns FALSE.
  • Use ISBLANK instead of ISNULL in new formulas. ISBLANK has the same 
    functionality as ISNULL, but also supports text fields. Salesforce.com will continue to 
    support ISNULL, so you do not need to change any existing formulas.
  • A field is not empty if it contains a character, blank space, or zero. For example, a field 
    that contains a space inserted with the spacebar is not empty.
  • Use the BLANKVALUE function to return a specified string if the field does not have a 
    value; use the ISBLANK function if you only want to check if the field has a value.
  • If you use this function with a numeric field, the function only returns TRUE if the field 
    has no value and is not configured to treat blank fields as zeroes.

Difference between 15 digit and 18 digit ID in Salesforce

  • 15 digit case-sensitive version 
  • 15 digit ID is referenced in the UI
  • 18 digit case-insensitive 
  • 18 digit id is referenced through in the API
  • Why do we need 18 digit IDs, because many Legacy system [ex: excel sheets] work with Case insensitive IDs
  • The id displayed by a report is the 15-digit case-sensitive id. The ids returned by web services api are 18-digit id. For updates web service accept both the 15-digit and 18-digit ids.


BreakDown of 15 Characters - 

As there is a combination of lower and upper case letters the casing of the 15 character Id has significance. E.g. 50130000000014c is a different ID from 50130000000014C.
Within a 15 character Id the breakdown is:
  • First 3 characters - The first 3 characters are the key prefix that identify the object type. There are some exceptions to this where multiple objects all share the same key prefix! 
  • There are a number of fixed key prefixes that are common across all of Salesforce .  Custom objects in managed packages can have a different keyprefix in each installed org.(Cross check once)
  • The 4th and 5th characters - Reserved. Currently used for the instance id / POD Identifier. Indicates which pod/instance the record was created on.
  • 6th character - Reserved. Will be 0 until such time that Salesforce has a need for it. See more
  • Remaining 9 characters - basically a really big number. Like 62^9 big.
To this you can add an optional 3 character suffix that will make the Id unique case-insensitive.
 This is useful when working with programs that can't maintain the case of the ID (E.g. Excel VLookup).