web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Click to Copy Button for each field.

(0) ShareShare
ReportReport
Posted on by 70

Some complex fields like Optionset, Lookup and Date fields are not to copy and paste. I would like to have a Copy button beside each field and the user can copy the value or label of the field with a click that button. How do I do that?

Sample Copy Button

pastedimage1626360372173v1.png

I have the same question (0)
  • Suggested answer
    Wahaj Rashid Profile Picture
    11,323 on at

    Hi,

    Thank you for your query.

    There is no out-of-the-box option for this purpose.

    I also do not see any PCF control that will full this requirement.

    You can try building an HTML Web resource or your own PCF control to provide this functionality.

    In short, there is no easy for it.

  • Dyname365 Profile Picture
    70 on at

    Thanks I will read up more on both methods.

    Trying to find the best ways to achieve this.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

    You need to create web resources(buttons) for the fields you want to copy and add an onClick event via standard JS.

    To copy to the clipboard, you can use the following code:

    document.getElementById('').onclick = function copy() {
        var copyText = window.parent.Xrm.Page.getAttribute("new_startdate").getValue();
                    
        var objectText = document.createElement('input');
        document.body.appendChild(objectText);
        objectText.value = copyText;
        objectText.select();
        document.execCommand("copy", false);
        objectText.remove();
        alert("Copied the text: "   objectText.value);
    }
    

    Result:

    pastedimage1626413145496v1.jpeg

  • Dyname365 Profile Picture
    70 on at

    Thanks. That is helpful. I will try as soon as I get a chance.

  • Suggested answer
    meelamri Profile Picture
    13,218 User Group Leader on at

    Hi,

    Frank Gong's approach is not supported because it uses DOM manipulation...

    Another approach is to create two buttons: "Copy" and "Paste".

    Copy: When clicking on Copy, a dialog box will appear with the list of fields in your form. The user can select the fields to be copied.

    Paste: When the user clicks on Paste on the second form, all the fields selected before will be pasted

    Finally, you can use the browser session to store the values to be copied.

    I might try to implement this scenario... it seems like something practical.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 180 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans