1

I am new to Microsoft Dynamics. I need to build a feature into a Microsoft Dynamics 365 On-Premises form that allows users to:

  • Select files to upload via an “upload files” button
  • Send those selected files to a remote MS SQL Server database (i.e. not the Dynamics database)

The first part seems like straightforward HTML and JavaScript:

<h3>Select files to upload:</h3> 
<input type=“file” itemId=“myFiles” multiple /> 
<p>Choose files to upload and then click “Send” to send the files to the remote DB.</p>
<button onclick=“uploadButtonClick()”>Upload</button>
<script>
function uploadButtonClick(){
// Gather file names, then prepare for SQL Server upload magic
} 
</script>

The second part is where I am stuck because I don’t know how to pass the upload file names to server-side code and then send those files to the remote SQL Server database. I can write the C# myself outside of Dynamics in a separate .NET C# project, but am unaware of how it is done via best practice in Dynamics 365. A custom Plug-in? WebAPI? Something else?

Is there a tried-and-true approach for doing the above in Dynamics 365?

Fuzzy Analysis
  • 3,168
  • 2
  • 42
  • 66

1 Answers1

1

Net to net, this is a simple HTML, Javascript, AJAX file upload requirement. Dynamics 365 web resource is no different, except cross origin request. No need to use CRM plugin or web api.

You will find thousands of examples online, maybe in SO itself. Start with this thread and build the code. You need a web api endpoint to POST url which handle your file insert into on-prem remote SQL DB. Read more