Dynamics AX: How can I open a docuview document attached to a Purchase Requisition from a Purchase Order?

StackOverflow https://stackoverflow.com/questions/801735

  •  03-07-2019
  •  | 
  •  

Question

Edit: The objective is to make quote documents that were attached to Purchase Requisitions available to staff that processes the Purchase Orders directly an in an easy way without having to navigate back to the requisition document itself.

I would like to use the DocuRef::openDocHandling method from within the Purchase Order screen without duplicating the document that was linked to the Purchase Requisition. I would like to do this from a button that I will add to the Purchase Order Screen; I do know what the Requisition Number is that is linked to the Purchase Order.

Many thanks in advance.

Was it helpful?

Solution

In form PurchTable add a datasource VendPurchOrderJour with the (active) purchase requistion. You do not have to display any of the fields of the datasource, so you might use the OnlyFetchActive property. Then create the form method "docCursor", to tell the DocuView form which record is the active one.

public Common docCursor()
{
    return reqDoc ? vendPurchOrderJour : purchTable;
}

Create the button with a "clicked" method:

void clicked()
{
    reqDoc = true;
    if (!infolog.docu().isDocuViewSet())
        infolog.docu().note(element);
    else
        infolog.docu().setActive();
}

Clear the "reqDoc" in the "active" method of PurchTable.

This solution does not allow for documents on purchase lines, you may have to expand the solution like this (line is a form group):

public Common docCursor()
{
    return reqDoc ? vendPurchOrderJour : 
                    line.contains(element.selectedControl()) ? purchLine :
                    purchTable;
}

OTHER TIPS

If you want a button to open the document view if not open and activate if open, then your clicked method should look like this:

void clicked()
{
    if (!infolog.docu().isDocuViewSet())
        infolog.docu().note(element);
    else
        infolog.docu().setActive();
}

Your question is unclear on your objective. What do you want? Please expand.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top