File Upload in D365
First Create a simple for and place button two buttons file upload & download

When user click on file upload button. the below statement will triggere File upload statement: File::GetFileFromUser()
and Code of Download button is again a one-liner: new Browser().navigate(fileUrl).
[Form]
public class SLD_UploadDownload extends FormRun
{
str fileUrl;
[Control("Button")]
class UploadButton
{
public void clicked()
{
FileUploadTemporaryStorageResult result = File::GetFileFromUser() as FileUploadTemporaryStorageResult;
if (result && result.getUploadStatus())
{
fileUrl = result.getDownloadUrl();
info(fileUrl);
}
}
}
[Control("Button")]
class DownloadButton
{
public void clicked()
{
new Browser().navigate(fileUrl);
}
}
}
No comments:
Post a Comment