In a component, I'm returning a list of ContentNote from the server and displaying the records' data in an aura:iteration.

Including ContentNote.Content (a base64-type field) in the return from the server-side controller causes an internal server error:

return [SELECT Content, Title, CreatedDate FROM ContentNote WHERE Id IN :noteIds ORDER BY CreatedDate DESC];

However, if I remove the Content field, then the internal server error isn't thrown, and the component inits and renders fine:

return [SELECT Title, CreatedDate FROM ContentNote WHERE Id IN :noteIds ORDER BY CreatedDate DESC];

The documentation states "A server-side action can return any object containing serializable JSON data."

I suspect this is because there's a Salesforce issue serializing the base64 Content field to JSON, but I only know for certain that including the field in the response cause the error.

Is there a specific approach to retrieving a base64 field from the server? I would prefer to keep the attribute in the component a List<ContentNote>, but I can move to a wrapper class that returns the Content field decoded as a string if that's the only workaround.

  • How about returning a string using JSON.serialize() and then using JSON.parse at the front end ? Commented Mar 27, 2017 at 20:45
  • I wanted to see first if there was a way to pass in the base64 data as part of a record - I ended up having to do something similar to your suggestion - separating the Content data from the record, decoding it to a string server-side, and then passing it to the component separately from the records Commented Mar 28, 2017 at 3:56

1 Answer 1


I didn't find a way to directly return the base64 field as part of the ContentNote record.

I ended up having to use the workaround in the question - omitting the base64 field from the query, and returning the list of records without that field - and then decoding the base64 field using .toString(), and passing it separately to the client side as a string...

You must log in to answer this question.

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