ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

How attach files without tempblob record?

Open aetxebarria opened this issue 7 years ago • 2 comments

I have an extension to attach files into a record, and of course, withe the new version I get the error, and the solutons proposed: Error: Argument 1: cannot convert from 'Record TempBlob' to 'var Codeunit "Temp Blob"' Solution: Use codeunit 4100 "Temp Blob" API instead of the record API.

Im' trying to find the solution, but I don't get any. I've found this: https://community.dynamics.com/business/b/dynamics365businesscloudfronts/posts/how-to-attach-documents-to-any-record-of-any-table-in-business-central But they use the tempblob record, so I can't use that. I've openned the baseApp to see how it's done inthe standard, but I cannot use that way either: imagen Which is the corerct way to create a extension for cloud in the latest release to attach files? Thnak you very much!

aetxebarria avatar Oct 03 '19 10:10 aetxebarria

Hi @aetxebarria,

I've also an extension storing files directly in blob field and of course it's broken in BC 15 release. I solved it this way:

[..]
fileMgmt.BLOBImportWithFilter(TempBlobCodeunit, SelectFileMsg, '', FileFilterTxt, 'txt');
tempBlobCodeunit.CreateInStream(streamIn);
"MyBlobField".CreateOutStream(streamOut);
CopyStream(streamOut, streamIn)
[..]

Maybe that helps you...

sirhc101 avatar Oct 06 '19 16:10 sirhc101

Hi @sirhc101, Thank you, it worked!!!!!

aetxebarria avatar Oct 07 '19 09:10 aetxebarria