Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Field attachment on CRM

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
    Ahmad Saud 790 on at
    RE: Field attachment on CRM

    thanks a lot Mahender for your quick and useful feedback.

  • Verified answer
    Mahendar Pal Profile Picture
    Mahendar Pal 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
    Ahmad Saud 790 on at
    RE: Field attachment on CRM

    it is different from what i need.

    thanks,

  • Suggested answer
    sandeepc Profile Picture
    sandeepc 5,005 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans