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 :
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
    239,035 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

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 659

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 465 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans