0

Very new to Salesforce. I'm trying to put together a little Apex Class to use as an action in a Flow. The Goal is to take the Content from a contentNote and clear the Blob data to then display the text in a screen flow.

Sorry to say I have no coding training so I'm trying to put this together from various sources, so far I have come up with the following but it won't save and has the following error:

Method does not exist or incorrect signature: void toString() from the type String

public class RemoveBLOBdata{
    
    @InvocableMethod(Label='Removes BLOB data and returns plain text')
    public static List<String> toString(List<Blob> myBlob) {
   
    List<String> textContent  = new List<String>();
    for (string s : myBlob) {
         textContent.add(s.toString());
        }
        return textContent;
    }
}

Any help would be much appreciated. Thanks

1 Answer 1

0

The error arises from the fact that you told the compiler that s is a String, but it's really a Blob.

for(Blob s : myBlob) {

Aside from that, as feedback to someone just learning coding, consider using more than one-character variable names, and be sure to clean up the indentation so that your code is easier to read. The bad habits you get in to now with regards to programming will lead to bad code later. Consider going through this trailhead module if you haven't already done so.

You must log in to answer this question.

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