• #27213
    Salesforce | Shubham Shubham #225

    How to get Encoded Value when querying in Salesforce Batch Class?

    I have created a text field on user in which i am saving the sharepoint login name which i have to use for some further api requests.

    Sharepoint login name is saved in the following format: i:0#.f|membership|[email protected]

    But when i query the same field in batch class strangely | character is automatically encoded to | and following system debug is shown

    i:0#.f|membership|[email protected]

    I want the original value stored to make a valid API request. Also i wanted to know the reason why this is happening.


    Salesforce | PRANAV PRANAV #653

    Hi Shubham,

    The vertical bar ( | ) is a computer character and glyph with various uses in mathematics, computing, and typography.

    The vertical bar is encoded in Unicode at U+007C | Vertical line (124decimal · HTML |).


    So to decode the HTML character in Apex class

    You have to use unescapeHtml4()

    For Example:
    string str =’Ришат|’;
    string decode = str.unescapeHtml4();
    system.debug(‘@@@ ‘+decode);

    Hope this helps you.

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

Please to reply to this topic.


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 2018 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?