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 :
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
    237,965 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,361 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

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

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 434 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans