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 :

Secured By miniOrange