Thursday, 10 May 2018


Route Version Active and approved in ax 2012 using x++



static void Aks_routeVersionApproval(Args _args)
{
RouteTable  routeTable;
    RouteVersion        routeversion;
     RouteApprove                routeApprove;
    RouteVersionApprove         routeVersionApprove;
    RouteVersionActivate        routeVersionActivate;
   
 
while select forUpdate routeversion
    where routeversion.Approved == NoYes::No
    {
       
            if (routeVersion)
            {
                routeVersionApprove = BOMRouteVersionApprove::newRouteVersion(routeVersion);
                routeVersionApprove.parmApproveRoute(true);
                routeVersionApprove.parmRemove(false);
                routeVersionApprove.parmApprover(HcmWorker::userId2Worker("akshaykupra"));//curUserId()));
                routeVersionApprove.run();

                routeVersionActivate = BOMRouteVersionActivate::newRouteVersion(routeVersion);
                routeVersionActivate.run();
            }
       
     
    }
     info("done");
   
   
}


curUserID() is ther approver user id.




Thanks
Akshay

No comments:

Post a Comment