Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

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

$
0
0

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


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>