Because why not?

Problem: How do I get this lost raccoon from a D365 attachment to another part of the cloud?

Spoiler: You're going to DB partner

First, we need to create a custom web service that can fetch our friend:

    public FileDataString getStuff()

        DocuRef docuRef;
        FileDataString FileDataString = '';

        select firstonly docuRef where docuRef.Name == 'RaccoonPardner';

            container data =
            if (data && conLen(data) > 0)
                BinData binData = new BinData();
                FileDataString = binData.base64Encode();
        return FileDataString;


Second, we need a logic app to call the service:

Here is the code view to better show the expression in File Content.  The key method I use is base64ToBinary().

And there it is: