Change RFQ purchase order status as draft insted of default approved | CloudFronts

Change RFQ purchase order status as draft insted of default approved

When we create purchase order using RFQ its default approval status will be approved.

To change that status to draft write following code where we will change its status to draft.

create new class and add following code

class CFSPOStatusRfq

{

    [PostHandlerFor(classStr(PurchAutoCreate_RFQ), methodStr(PurchAutoCreate_RFQ, endUpdate))]

    public static void PurchAutoCreate_PurchReq_Post_endUpdate(XppPrePostArgs args)

    {

        //PurchTable  purchTable = args.getThis(‘purchTable’);

        PurchAutoCreate_RFQ purchReq = args.getThis() as PurchAutoCreate_RFQ;

        PurchTable  purchTable, purchTablenew;

        purchTable = purchReq.parmPurchTable();

        ttsbegin;

        select forupdate purchTablenew where purchTableNew.PurchId == purchTable.PurchId;

        if(purchTablenew && purchTablenew.DocumentState == VersioningDocumentState::Approved)

        {

            purchTablenew.DocumentState = VersioningDocumentState::Draft;

            purchTablenew.update();

        }

        ttscommit;

    }

}


Share Story :

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close