top of page

Attach an Image to a D365 Customer Service Case record


How is it going? Hot still? Yep. I'm boiling. Crystal Maze dome is still in full effect.

I am baking.

Anyway, hope it's not too hot for you. Yes, I know I complain about the weather, sorry, ok!


A Microsoft Form allows people to attach screenshots of an issue they are facing with an application they are using. We want to create a Case record in Dynamics 365 (D365) for Customer Service and then update that same case with a note entry which attaches the jpg that has been uploaded by the customer.

Disclaimer: I am not D365 Customer Service expert, I just like playing around and getting into the tech when I can.


We are going to need to spin up a D365 Customer Service Trial environment, you can do this here.

This will give us the Case table inside Dataverse.


First of all, we need to create a Microsoft Form, to capture a file upload. Go to and create a form, and the initial question choose the file upload question type, I'm not going to go into a lot of detail on this, but my form looks like this:

This will automatically create a folder structure inside your OneDrive for Business:

This is where the files that are uploaded from the form will be stored.

Power Automate

Let's jump over to Power Automate -

What we want to do here is to create an automated cloud flow that will monitor the OneDrive for Business folder above, and when a new jpg is created, the cloud flow executes. It will then create a Case in D365 Customer Service and then create a Note record in the Notes table and associate it with the Case that has just been logged.

In the words of Bobby Brown - let's break it down....

First step is to create the trigger, we are going to use the "When a file is created" OneDrive for Business step:

Next, we are going to create a case, to do that we choose the "Add a new row" Dataverse action:

For the case title, I have just put in Test utctnow(). This will give the case title the title of "Test " plus the current date and time.

For the case type I chose "Question", you can leave this blank if you want, it's not a required field.

For Customer (Accounts), I went into the Customer Service Hub app, into Accounts and selected an account at random and then got the GUID at the end of the URL:

The syntax to lookup an associated record is to use the plural name of the table and then put the GUID in brackets as I have done in the screenshot above.

We have now created the case.

Next, we need to create a Note record, attach the jpg image and associate it to the Case we have just created.

Add a new step, and choose "Add a new record" from the Dataverse actions:

Here I have chosen the Notes as the table name, put in Testing for the Title, and then changed the IsDocument property to Yes.

Inside the Document field, I am using the base64 expression, we have to do this to convert the file (located in the OneDrive folder) to an image, I am choosing the File Content from the dynamics content, we then give it a filename as I have above. For this, to make it unique, I have called it test and then the following expression formatdatetime(utcnow(),'dd-MM-yyyy').

This will add the current date to the end of the file name. Finally, I appended the file extension.

The other part of the same "Add a new row" step is to associate the Note record with the created Case from the previous step. To do this, scroll down inside this Add a new row step, and find the "Regarding (Cases)" field.

As we did for the Customer above, we need to look up the unique reference of the Case inside the Case table. The Case tables logical name is incident, so the correct lookup code is:


Where Case is the unique identifier of the Case record from the previous "Add a new row" step:


Go back to the form you created and upload a jpg file:

Click Submit.

The file gets created in the One Drive folder:

The Power Automate cloud flow will then execute:

(I added in an extra compose step to pull out the case ID).

I then headed over to the Customer Service Hub with that Case ID:

I selected the case to open it, and I can see a note has been added with the jpg screenshot

I can now click on the jpg file to download and open it:

And here is the screenshot I took from my laptop:

Ok, maybe it isn't a screenshot from my laptop, but you get the idea :)

As always, my inbox is always open -

Speak soon!

305 views2 comments

Recent Posts

See All



Thanks, can you also do the vice versa? That is fetch the file from the timeline and upload to OneDrive?

Jon Russell
Jon Russell
Nov 23, 2023
Replying to

Yes. Pretty sure you can.

bottom of page