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

Notifications

Announcements

No record found.

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,321 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,216 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 73 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans