Forum Replies Created

  • Adam

    Member
    November 1, 2018 at 10:46 pm in reply to: What is the difference between empty and null in Salesforce?

    Another one to test us on 🙂

    From the outside the difference can appear very slight.  But to code that is running, it could mean very different outcomes!

    In coding (once again I am assuming it is in the context of APEX), something could be NULL because it doesn't exist or hasn't been instanciated (ie it hasn't been created/setup).

    Where as empty has two possible outcomes/possibilities.  It could mean that it is a string/text (as an empty) that is nothing.  For example ''.  There is nothing in between the ' and the '.  But the code has allocated memory to the variable, even if there isn't any actual text stored.  Additionally, it could also mean NULL (see above).

    The Salesforce documentation also makes note of 'blank' which essentially has three possible outcomes: that whitespace is stored in the field, that '' is stored in the field, or NULL.  So when using forumals in Salesforce, I always try to use ISBLANK(), as it is the most 'inclusive' of the three functions.

  • Adam

    Member
    November 1, 2018 at 10:15 pm in reply to: What is split() in Salesforce?

    Hiya, what context are you refering to?  Have you found it in some code?

    I assume you are making reference to APEX code?  Ultimately it is used as a way to break a string/text value down into a list.

    There is a good example on the Salesforce developer forums here, where the Ravindra provides an example of breaking an address down into its smaller components.

    If you want to see the official documentation for the method, you can use the APEX Developer Guide (though if you are not a developer this link may be a little daunting): string method.split().

    Hope that helps!

  • Adam

    Member
    January 10, 2018 at 10:52 pm in reply to: How database methods different from DML statements in Salesforce?

    There are a number of small differences. But from my understanding using database methods allow you control over how Salesforce handles failures in a batch. By setting a parameter (allOrNone) on a number of methods to either true or false you control how it processes failures in the batch.

    So does it roll all records in the batch back or does it fail just the record in question. Check out https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_database.htm

    I am sure there are a few other differences, but that is first to mind.

Popular Salesforce Blogs

Popular Salesforce Videos