Trying to show the content field (blob) from contentNote in Visualforce. All that shows is "core.filemanager.ByteBlobValue@225c5e8c". I realize that I must somehow change the blob to text, but I cannot figure it out.
Here is my class:
public list<ContentNote> getConNote() {
String cdlId;
List<ContentDocumentLink> cid = [Select ContentDocumentId From ContentDocumentLink Where LinkedEntityId = :RelatedTo];
for(ContentDocumentLink c: cid){
cdlId = c.ContentDocumentId;
}
return [Select Title, Content
From ContentNote
Where Id = :cdlId];
}
And here is the section of my vf page:
<apex:dataTable value="{!ConNote}" var="cn" styleClass="slds-table slds-table--bordered slds-table--striped" >
<apex:column width="200">
<apex:outputText value="{!cn.Content}" styleClass="slds-cell-wrap"/>
<apex:facet name="header"> Notes</apex:facet>
</apex:column>
</apex:dataTable><br /><br />
UPDATE:: Here is what I did, just in case it can help someone else. Class:
public static String getContent() {
String RelatedTo = ApexPages.currentPage().getParameters().get('id');
String cid;
Blob myBlob;
String s;
List<ContentDocumentLink> cdlId = [Select ContentDocumentId From ContentDocumentLink Where LinkedEntityId = :RelatedTo]; {
for(ContentDocumentLink c: cdlId)
cid = c.ContentDocumentId;
List<ContentNote> cids = [Select Title, Content From ContentNote Where id = :cid]; {
for(ContentNote cn: cids)
myBlob = cn.Content;
s = EncodingUtil.base64Decode(EncodingUtil.base64Encode(myBlob)).toString().replace('<br>', '\r\n'));
}
}
return s;
}
VF:
<apex:dataTable value="{!Content}" var="s" styleClass="slds-table slds-table--bordered slds-table--striped" >
<apex:column width="200">
<apex:outputText value="{!s}" styleClass="slds-cell-wrap"/>
<apex:facet name="header"> Subject</apex:facet>
</apex:column>
</apex:dataTable><br /><br />