Because why not?
Problem: How do I get this lost raccoon from a D365 attachment to another part of the cloud?
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';
if(docuRef)
{
container data =
DocumentManagement::getAttachmentAsContainer(docuRef);
if (data && conLen(data) > 0)
{
BinData binData = new BinData();
binData.setData(data);
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: