Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only

Attach Documents on Closed Purchase Orders

  • 1.  Attach Documents on Closed Purchase Orders

    Posted Fri October 22, 2021 12:20 PM
    Recently, a user requested to open a closed PO (PO invoiced and paid) as the user forgot to attach some important documents. Although not recommended we were forced to update the status of the PO from the backend to APPR, allow the user to attach the document, and return status to CLOSE. 
    The client requested a solution that will allow users to attach documents on Closed PO. Without much thought, the Edit History option on Work Order Tracking was implemented as a customized solution to allow ONLY documents to be attached on a PO with status CLOSE.

    Following are the steps:
    1. Create a SIGOPTION with the name EDITHIST - Edit History
    2. Apply the option to Select Action Menu
    3. Add the EDITHIST option to the POAppBean Class

    public int EDITHIST()
    throws MXException, RemoteException
    {
    WebClientEvent event = sessionContext.getCurrentEvent();
    DataBean appBean = Utility.getDataSource(sessionContext, app.getAppHandler());
    POExtRemote poMbo = (POExtRemote)getMbo();
    poMbo.editHistory();
    appBean.fireDataChangedEvent();
    sessionContext.queueRefreshEvent();
    return 1;
    }

    4. Extend PO and PORemote java class to implement the edit functionality - in this case ONLY to open the DOCLINKS object to add documents.

    To PORemote extended methods:

    public abstract void editHistory()
    throws MXException, RemoteException;

    public void setRelatedMboEditibility(String relationName)
    throws MXException, RemoteException

    To PO extended methods:

    public void editHistory()
    throws MXException, RemoteException
    {
    String currentStatus = getTranslator().toInternalString("POSTATUS", getString("status"));
    if(!currentStatus.equals("CLOSE"))
    throw new MXAccessException("po", "NoEditHist");

    setFlag(7L, false);
    String editable[] = {
    "changeby", "changedate", "description"
    };
    setFieldFlag(editable, 7L, false);
    setRelatedSetEditibilityFlags();

    }

    protected void setRelatedSetEditibilityFlags()
    throws MXException, RemoteException
    {
    if(!isNew())
    {
    setRelatedMboEditibility("DOCLINKS");
    }
    }

    public void setRelatedMboEditibility(String relationName)
    throws MXException, RemoteException
    {

    MboSetRemote relatedSet = getInstanciatedMboSet(relationName);
    if(relatedSet == null)
    return;
    if(relationName.equals("DOCLINKS"))
    {
    relatedSet.setFlag(7L, false);
    return;
    }

    }


    We are on the verge of moving the java solution to an automation script that should work with a few lines but my thought goes to having to invoke a fake save without actually saving the record before the document is attached. 


    ------------------------------
    Nivin Jacob George
    Senior Consultant
    Praxis Solutions
    Kuwait
    ------------------------------

    #AssetandFacilitiesManagement
    #Maximo