Activity Forums Salesforce® Discussions How to create a Salesforce custom field to display data in a format, in a HTML Template?

  • Adarsh

    Member
    March 27, 2018 at 10:47 am

    Hi J,

    HTML templates can only display basic fields. So, you would need a formula field:

    MaskedCustomTextField__c (Text) =
    LPAD(CustomTextField__c,LEN(CustomTextField__c)-4,"X") &
    RIGHT(CustomTextField__c,4)
    Put the formula field into the HTML template, and you're good to go:

    {!Account.MaskedCustomTextField__c}
    If you use a Visualforce template, you can put it directly in to your text:

    {!LPAD(CustomTextField__c,LEN(CustomTextField__c)-4,"X") &
    RIGHT(CustomTextField__c,4)}

     

    Hope it helps 🙂

  • Neha

    Member
    March 27, 2018 at 11:02 am

    HTML templates can only display basic fields. So, you need to create a formula field:

    EncryptedField__c Formula's:

    LPAD((RIGHT(CustomTextField__c,4)),LEN(CustomTextField__c),"X")

    Put the formula field into the HTML template, and you're good to go:

    {!Account.EncryptedField__c }

    I have validated with Phone field on Account and it works for me. Hope this helps you too.

    • This reply was modified 6 years, 8 months ago by  Neha.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos