> For the complete documentation index, see [llms.txt](https://dyns.ntd.asia/power-dynamics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dyns.ntd.asia/power-dynamics/d365-ce/customer-experience/attachment-control.md).

# Attachment Control

\#MDA, #Dataverse, #AttachmentControl, #D365, #CustomerService, #Case

## Add Attachment Control for a custom entity

The **Attachment Control** is a PCF control in D365 Customer Service.&#x20;

This control is set on **Case** forms as default so that you can upload and view attachments. Moreover, you can use this PCF on other entities: **Account** or **Contact**, **but this was not possible for custom entities until now.**

{% hint style="info" %}
Note: You must have at least 1 D365 Customer Service Enterprise or Professional license.
{% endhint %}

Now, I will add the Attachment Control for the **Case** main form

Opening the solution, select the **Case** entity, and open the specific main form. Then select the existing or add a new ***Single Line of Text*** field to the form and add the **Attachment Control** over that field as below. Then Save & Publish the form.

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FQ8dYPVrVaovYwLCaVZee%2Fimage.png?alt=media&amp;token=6ae3453d-f30c-41f0-bae5-35ebedd43a4e" alt="" width="563"><figcaption><p>Add control on Main form for text field</p></figcaption></figure>

Checking... and the attachment control has been shown on **Case's main form.**

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FCRJEsKMP9yEGqJxMUHxm%2Fimage.png?alt=media&amp;token=6ed8849c-9547-4294-873d-6da156e13f8a" alt=""><figcaption><p>Attachment control on Case form</p></figcaption></figure>

## Security Role - Permission

When I display this control on the form, I encounter a permission issue when I click the button **<+Add attachment>** to attach the file to Case.

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FZpEfxddvpTTAmaSRUbMd%2Fimage.png?alt=media&amp;token=7bb38cdb-08dc-43fc-83bc-41bb04546104" alt=""><figcaption><p>Permission Issue</p></figcaption></figure>

**Working around and found some things:**

* Firstly, you must enable security on the Attachment entity in ***Settings> Product > Features***

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FVCyUnbxbkZL4u9EZmIqN%2Fimage.png?alt=media&amp;token=c29ea876-a11e-43a0-baab-376afbbfddc0" alt=""><figcaption><p>Enable security on Attachment entity</p></figcaption></figure>

* Second, you must set permission of entity **"Entity Attachment"** for the Security Role that was assigned to the User.

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FzSeljZn1dyISzF8wwZXL%2Fimage.png?alt=media&amp;token=c556ad0e-d78c-4ddd-a171-7cc38cb24240" alt=""><figcaption><p>Set permission for Entity Attachment</p></figcaption></figure>

... and re-checking now

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FOY39foDuQXHi1Nuj2P6L%2F_check_attachment_control.gif?alt=media&amp;token=68c9f531-c134-48d8-9767-82c2b4f9c412" alt=""><figcaption><p>Check attachment control</p></figcaption></figure>

And the entity "Entity Attachment" is not counted in "Dataverse" capacity, this entity is counted in **"File"** capacity.

<figure><img src="https://4233060750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjhtQupP7ACZVtv3cCNCr%2Fuploads%2FsDSAlEPE2WDdCVbX9tVt%2Fimage.png?alt=media&amp;token=a083c57f-6d00-4064-8f7c-0c6dbee3640a" alt=""><figcaption><p>Entity Attachment is counted in "File" capacity</p></figcaption></figure>

For more details, please check the Microsoft [link](https://learn.microsoft.com/en-us/dynamics365/customer-service/administer/add-attachment-control).

Thank you and hoping well.\
**\[NTD]yns.asia**\ <mark style="color:red;">...</mark>[<mark style="color:red;">invite me a cup.</mark>](https://ko-fi.com/ntdyns/?ref=qr\&amp;v=2) :coffee: Thank you. :heart:
