Fuzzy Analysis
Fuzzy Analysis

Reputation: 3188

Custom JavaScript and Server-Side Code Interaction in Microsoft Dynamics 365 (On-Premises)

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

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?

Upvotes: 1

Views: 347

Answers (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

Upvotes: 1

Related Questions