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

Opening DocuRef record from another form

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have a custom requirement, in which I have to access DocuRef attachment in Sales Order form, with my custom form. Right now I have a custom table in which I am getting the field of Sales Id. After some research, I found this static method in DocuRef class:

DocuRef::openDocHandling(Common _common, Object _element);; 

In my case

_common: is the SalesTable record, which I can get with SalesTable::find(SalesId);

_element: is the FormRun object, and it seems to be the only missing link as the caller in my case, is my custom form. And sending Null is just resulting in an empty form with no records.

Is there any other of accomplishing the above requirement? I have an add-on requirement as well in which I have to access attachment on Production order with my custom form(I also have the ProdId with me).

Thanks.

I have the same question (0)
  • Sumit Loya Profile Picture
    2,230 on at

    I would suggest adding SalesTable and prodTable Ds as child data sources and then open the form using that code and instead of passing null pass element (formRun instance). That should work

  • Verified answer
    Community Member Profile Picture
    on at

    Hi,

    I tried the solution you suggest but it did not work out.

    After a bit more research, I was able to arrive at the solution:

    Instead of calling DocuView Form from DocuRef::openDocHandling, I added the "DocuView" menu item into my form

    And like you suggested, I added the data source of SalesTable to my form. And joined the SalesTable Datasource with my local form data source (link type: Delayed).

    And override the docCursor() method:

        public Common docCursor()
        {
            Common ret;
        
            ret = super();
    
            if(docuRecord)
            {
                ret = docuRecord;
            }
    
            return ret;
        }

    DocuRecord is just a global variable, which is set the on the "Click" method of "DocuView" menu item.

            public void clicked()
            {
                docuRecord = SalesTable;
    
                super();
    
                docuRecord = null;
            }

    I was able to similarly achieve the result for the ProdId. In this case, on click method, I passed ProdTable datasource into docuRecord,

    PS: Buffer in docCursor method has to be from form's datasource, otherwise this will not work

    Thanks

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