0

We have developed a custome emails section through custom vf page. Need to display the sub string of text body from the email message object. Below is the custome email section we have developed : enter image description here

below is the standard email section: below subject of every email message another line displays which is a part of email textbody. enter image description here To display the subject from controller we are writing below lines in vf page

<apex:column headerValue="Subject">
        <a href="/{!items.id}" style="{!if(items.status == '0','cursor: pointer;font-weight: bold;','cursor: pointer;')}"
            onclick="openDetailPage('{!items.id}', '{!items.Incoming}')" >
          {!items.Subject}</a>
</apex:column>

trying to use <apex:outputtext></apex:outputtext> after <a/> tag to display the starting line from email message text body. I got the idea of using the method textbody.substring(0, 5) can you give me some clue how to use this method to get the required out put.

2
  • 1
    why not use {!LEFT(items.Subject,5)} ?
    – cropredy
    May 16, 2019 at 18:33
  • Thanks cropredy that worked. But i need to apply this on TextBody not on subject. below line i added that resolve my issue. <apex:outputtext style="font-family:arial;font-size:11px;color:DimGray" value="{!LEFT(items.TextBody,77)}..."></apex:outputtext> thank you so much for the quick suggestion. May 16, 2019 at 19:31

1 Answer 1

0

One way to easily substring a field is to use formula expressions

<apex:outputText value="{!LEFT(items.textbody,n)}/>

where n is the number of characters you want. n could even be a merge field from the controller.

VF has access to almost the entire function library available in SFDC as seen here in the VF doc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .