Notifications
Announcements
No record found.
Dear All,
I want to add two attachment in notes using html and upload it using plugin but the attachment should have two separate upload buttons like this
*This post is locked for comments
Hi,
You should use "annotation (note)" entity in Dynamics CRM and attach (upload) file to this. Of course you need read your files with your code and get Base64 or ByteArray data to create annotation attachment. You can see details about annotation entity on https://msdn.microsoft.com/en-us/library/gg334398(v=crm.8).aspx and also find sample code to upload https://msdn.microsoft.com/en-us/library/gg328429.aspx
Other way, you can use my library called XrmLibrary that includes some helper methods to do SDK operations by easyway, sample codes below;
EntityReference entityReference = new EntityReference("your primary entity logical name", Guid.Parse("your record ID")); AttachmentData attachmentData = AttachmentHelper.CreateFromPath(@"your file path", "your file name"); //you can also use "CreateFromBase64", "CreateFromByte", "CreateFromStream" AnnotationHelper annotationHelper = new AnnotationHelper(organizationService); annotationHelper.Create(entityReference, "Your note subject", "your note text", attachmentData);
I'd add a couple of things:
- You can have only 1 attachment per note (because attachments is stored in the note.. it's just a field there)
- There is an awesome drag-drop example here:
https://community.dynamics.com/crm/b/microsoftdynamicscrmandstuff/archive/2016/10/27/drag-amp-drop-file-upload-part-1
You may not have to implement drag-drop, but that code may give you some ideas (most likely, if you want two buttons, you'll have to go for a web resource.. and, then, programmatically create two notes behind the scene)
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2