Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Custom Button to Copy record link to clipboard

(0) ShareShare
ReportReport
Posted on by 196

Hi

We got a customer who wants a custom button on the form navigation which copies the link of the current record to his clipboard. How can I do this and is it supported? It's the new ms crm v9 On-Premise.

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Custom Button to Copy record link to clipboard

    Hi,

    I hope this will help you.

    1.Add button to CRM using Ribbon Workbench

    2.Using following js code and Assign 'copyRecordUrl' to the button

    function copyRecordUrl() { 

    var globalContext=Xrm.Utility.getGlobalContext()
    var appUrl=globalContext.getCurrentAppUrl();
    var id=Xrm.Page.data.entity.getId();

    var url=appUrl+'&pagetype=entityrecord&etn=account&id='+id.slice(1,id.length-1);

    var tempTag = document.createElement('textarea');
    tempTag .value = url;
    tempTag .setAttribute('readonly', '');
    tempTag .style = {position: 'absolute', left: '-9999px'};
    document.body.appendChild(tempTag );
    tempTag .select();
    document.execCommand('copy');
    document.body.removeChild(tempTag );

    }

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Custom Button to Copy record link to clipboard

    Working with the clipboard from terms of supported/unsupported is falling to gray zone because usual approaches working with clipboard are implemented through DOM (and operations with DOM are considered as unsupported).

    Article that Ambar provided will not work for latest Dynamics 365 for CE. You will have to write own code using following:

    1. How to get proper url to record - docs.microsoft.com/.../open-forms-views-dialogs-reports-url

    2. How to put string to clipboard - techoverflow.net/.../copying-strings-to-the-clipboard-using-pure-javascript

    3. How to add button to CRM using Ribbon Workbench - ribbonworkbench.uservoice.com/.../71374-1-getting-started-with-the-ribbon-workbench

    Good luck!

  • Manuel Steiner Profile Picture
    196 on at
    RE: Custom Button to Copy record link to clipboard

    Hi

    Thanks but is this supported?

  • Suggested answer
    gupta.ambar2009@gmail.com Profile Picture
    797 on at
    RE: Custom Button to Copy record link to clipboard

    Hi,

    Go through with below article, hope it will help you .

    https://ivobouwman.net/2011/01/05/copying-dynamics-crm-form-values-to-the-clipboard/

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

🌸 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…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the 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 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans