Customize Archives -

Tag Archives: Customize

Customize Purchase order approval status

In the case of D365 Finance and Operations when you approve purchase requisition by default system creates Purchase order with approval status as “Approved” as follows     To change this default behavior of system such that once purchase requisition is approved the approval status of the purchase order as a draft you can use the following class class CFSPOStatus {     /// <summary>     ///     /// </summary>     /// <param name=”args”></param>     [PostHandlerFor(classStr(PurchAutoCreate_PurchReq), methodStr(PurchAutoCreate_PurchReq, endUpdate))]     public static void PurchAutoCreate_PurchReq_Post_endUpdate(XppPrePostArgs args)     {         //PurchTable  purchTable = args.getThis(‘purchTable’);         PurchAutoCreate_PurchReq purchReq = args.getThis() as PurchAutoCreate_PurchReq;         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;     } }and your final result looks like And after changing status you can apply your own purchase order workflow on it. For purchase order workflow you can refer to my blog

SEARCH :

FOLLOW CLOUDFRONTS BLOG :

[gravityform id="36" ajax="true"]

FOLLOW CLOUDFRONTS BLOG :