Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Change the context (datasource) of the doument handling button on a ListPage (x++)

Posted on by 1,650

Hello,

I'm facing the requirenment, that I have to change the context (datasource) of the document handling button (paper-clip Icon on the top Right of every form).

As far as i understand the button is bound to the main datasource of the form. I need to change it to a "non-main-datasource" in a ListPage. Due to other reasons I could not change the "dataSource" property of the form itself.

In the ListPageInteraction class tried somithing like, but I didn't find any method changing the datasource context:

#SysSystemDefinedButtons

FormCommandButtonControl attachButton;

attachButton= this.control(this.controlId(#SystemDefinedAttachButton)) as FormCommandButtonControl;

attachButton…..

Any ideas on this?

Thanks in Advance

Sebastian

  • Suggested answer
    Sebastian Aurand Profile Picture
    Sebastian Aurand 1,650 on at
    RE: Change the context (datasource) of the doument handling button on a ListPage (x++)

    Thanks for your response. I found a possible solution to this requirenment. The solution could be implemented via "overriding" the form method "docCursor":

    In a ListPage this has to be done via COC:

    Common docCursor()

    {

    Common ret = next docCursor();

    ret = salesTable;

    return ret;

    }

    The "docCursor" method returns the pointer for the DocuView Form.

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Change the context (datasource) of the doument handling button on a ListPage (x++)

    I would look into customizing the DocuRef form code, not the caller form. If DocuRef is opened from form X, change the data source query of DocuRef.

    What form is it? What data source do you want to link it to? Why? 

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans