web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM Plugin or Custom Workflow to download attachments from notes on a case?

(0) ShareShare
ReportReport
Posted on by

Hi all,

We currently have a workflow in our CRM 2016 on premise organisation - the workflow is an 'on demand' workflow with one step "Perform Action" which uses a Mail Merge template against the case entity and stores the merged document as an attachment against a new note on the case (there is no option to save elsewhere, this is OOTB functionality)

I would like to add to the functionality to add either a custom workflow or a plugin to allow for this generated document to be stored either on the users hard drive, or, if this is not possible, a sharepoint location or network storage location.

I am not sure if I should

a) Create a custom workflow step in the existing workflow which runs custom code against the case which gets all attachments against all notes, takes the most recent one and saves it to either the client machine hard drive or if this is not possible, a sharepoint or networked folder? If I choose this option, will the networked folder location need to be visible to the CRM server or will it need to be visible just to the client machine?

b) Create a plugin which runs on creation of any note, which downloads any attachment to either the save the download to the client hard drive or if this is not possible, to the sharepoint or networked folder location. If I choose this option, will the networked folder location need to be visible to the CRM server or will it need to be visible just to the client machine?

I have seen this code for downloading an attachment

https://msdn.microsoft.com/en-us/library/gg328429.aspx

I am not sure about the following:

// Download the attachment in the current execution folder.
                    using (FileStream fileStream = new FileStream(retrievedAnnotation.FileName, FileMode.OpenOrCreate))
                    {
                        byte[] fileContent = Convert.FromBase64String(retrievedAnnotation.DocumentBody);
                        fileStream.Write(fileContent, 0, fileContent.Length);
                    }



Can anyone advise what it means 'download the attachment in the current execution folder'? What if this code was part of a plugin or custom workflow activity, would the downloaded attachment be stored on the CRM server and is there a way to specify where else it could be saved (e.g. a mapped network drive which is visible both to the client machines and the CRM server)?

Thanks for any advice

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans