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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Copy text to clipboard when clicking a button

(0) ShareShare
ReportReport
Posted on by 260

Hi guys, 

I have a button that it is suppose to copy a txt field content to clipboard.

Currently, the code is like this piece below, but when I click it doesn't copy the field to clipboard. 

        void clicked()
        {
            TextBuffer tb;
            super();
        
            if(!ExampleTable.FieldValue)
                return;
        
            tb = new TextBuffer();
            tb.setText(ExampleTable.FieldValue);
            tb.toClipboard();
        }

I did a little debugging and the field value is there.

However, the tb.toClipboard(); is not doing anything.

Do you guys have any other approach?



Thanks

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    240,345 Most Valuable Professional on at

    X++ code running Azure can't directly modify the clipboard on the local machine where you're running your browser. It would have to handled by a script running in browser and I'm not aware of any such logic in D365FO. (It doesn't mean that I'm sure that nothing like that exists.)

  • Verified answer
    WillWU Profile Picture
    22,363 on at

    Hi bois0155,

    The toClipboard() method is used with windows form, and it won't work with browser application.

    Maybe you can try a third party tool or re-design a feasible solution.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
SajeedMullaji Profile Picture

SajeedMullaji 312

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 284 Super User 2026 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 258 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans