ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[External] Codeunit 419 - CreateFileNameWithExtension (Old)

Open fvet opened this issue 7 years ago • 3 comments

We often want to generate document names with a predefined name (not a temp name), completed with the document extension. Function 'CreateFileNameWithExtension' is suited for this, but not exposed.

  • [x] Solved in BC14

fvet avatar Feb 19 '19 19:02 fvet

We need this as well to migrate one of our add-ons. I have questions on it though...

  1. I assume we don't have folders and things available to use which is fine...so can we call a function to create a specific file name with an extension in the temp folder on the server?

  2. How are temp folders / files managed in the shared/cloud environment? We might have multiple tenants with our add-on using our functionality to create files at the same time where the file names are identical. Does each tenant get its own subfolder within the temp folder? Is there a risk of file conflicts?

RHansenEpimatic avatar Feb 19 '19 21:02 RHansenEpimatic

Can we get an OnBefore publisher as well?

In some scenarios, the CreateFileNameWithExtension function is called with 'FileName.Doc' instead of 'FileName', so we tend to double check if the 'FileNameWithoutExtension' input parameter actually has an extension in it, and if so, we strip it.

`CreateFileNameWithExtension(FileNameWithoutExtension : Text;Extension : Text) FileName : Text
FileNameWithoutExtension := FileManagementNVT.RemoveExtensionFromFileName(FileNameWithoutExtension); // NVT

FileName := FileNameWithoutExtension;
IF Extension <> '' THEN BEGIN
  IF Extension[1] <> '.' THEN
    FileName := FileName + '.';
  FileName := FileName + Extension;
END`

fvet avatar Apr 19 '19 11:04 fvet

@jobulsin Any possibility that this publisher will be backported to BC14? Couldn't find it in the latest sandbox image.

fvet avatar Sep 09 '19 10:09 fvet