• #62738

    What is Blob in Apex in salesforce ?

    What is Blob in Apex ?

    Salesforce | Nikita Nikita #16

    Hi Hariom,

    Blob is a collection of binary data stored as a single object. You can convert this data type to String or from String using the toString and valueOf methods, respectively. Blobs can be accepted as Web service arguments, stored in a document (the body of a document is a Blob), or sent as attachments.

     Saddam #27


    A blob is data type which collection of binary data, now if i will you I world definitely want to know what is binary data, so you may aware that information in computer is stored in the form of 0 or 1, so to construct a message in particular format whether it’s image or PDF file, it will be store in the form of series of binary data and that form or collection is known as blob.

    Blob is part of System namespace which provide methods and classes for apex core functionality, so we have separate blob class, which include some functions that help us to deal with multimedia in salesforce, i.e PDF . Let see all the methods that blob class provide us,

    Blob is mainly use in apex to deal with creating PDF files or strings, it doesn’t used to deal with other multimedia objects like images and music, we have a function which valueOf which convert the convert/cast the string into blob object, as we are casting the string into blob the return type of it will be of blob type, see example below.

    String testString=’test string’;
    Blob myBlob=blob.valueOf(testString);

    Salesforce | Ashutosh Ashutosh #74



    The Blob is a collection of Binary data which is stored as object. This will be used when we want to store the attachment in salesforce into a variable. This data type converts the attachments into a single object. If the blob is to be converted into a string, then we can make use of the toString and the valueOf methods for the same

    Blob Class
    Contains methods for the Blob primitive data type
    Blob Methods
    Returns the number of characters in the Blob.
    Creates a binary object out of the given string, encoding it as a PDF file.
    Casts the Blob into a String.
    Casts the specified String to a Blob.

Viewing 4 posts - 1 through 4 (of 4 total)

Please to reply to this topic.

Popular Salesforce Blogs


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2020 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?