File Upload in D365


File Upload in D365




First Create a simple for and place button two buttons file upload & download


2018-03-14_1426

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);
        }
    }
}

Support Faryal's Cusine


No comments:

Post a Comment

Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...