Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Field attachment on CRM

(0) ShareShare
ReportReport
Posted on by 790

dear all

i found the following code to solve the problem of adding a field of type attachment, it is working fine, but i need to be able to show the filename next to the button after upload is successful.

can you help me?

the code is :

<html><head>

<style>
.button {
background-color: 00bfff;
border: none;
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 10px;
cursor: pointer;
border-radius: 6px;
background-color: #ff0054;
}
</style>
<script>
function Addattachment()
{
var entityETC=10007; //entity code
var entityID =window.parent.Xrm.Page.data.entity.getId();//to read parent record ID
parent.Mscrm.RibbonActions.addFileToRecord(3, entityID) ;


}

</script>

<meta charset="utf-8"><meta><style type="text/css">P { margin: 0; }</style><meta><style type="text/css">P { margin: 0; }</style><meta><style type="text/css">P { margin: 0; }</style><meta></head>
<body style="overflow-wrap: break-word; word-wrap: break-word;" onfocusout="parent.setEmailRange();">
<button class="button" onclick="Addattachment()">Attach</button>
</body></html>

So i want to show the file name as in the below image :

3324.3.png

thanks,

*This post is locked for comments

  • Ahmad Saud Profile Picture
    790 on at
    RE: Field attachment on CRM

    thanks a lot Mahender for your quick and useful feedback.

  • Verified answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: Field attachment on CRM

    Hi Ahmad,

    You can query entity basedon the objectregarding id and fetch fiels names from notes entities and add them next the field.

    You can use Rest Builder to build your query to get field names.

    github.com/.../CRMRESTBuilder

  • Ahmad Saud Profile Picture
    790 on at
    RE: Field attachment on CRM

    it is different from what i need.

    thanks,

  • Suggested answer
    sandeepc Profile Picture
    5,470 on at
    RE: Field attachment on CRM

    community.dynamics.com/.../206038

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 54

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans