Friday, 18 January 2019

form method event handler + D365

 [PostHandlerFor(formStr(CITWHSPack), formMethodStr(CITWHSPack, closeContainer))]
    public static void CITWHSPack_Post_closeContainer(XppPrePostArgs args)
    {
        FormRun formRun = args.getThis();
        WHSShipmentTable shipmentTable = (formRun.dataSource("WHSShipmentTable") as FormDataSource).getFirst() as WHSShipmentTable;
        if(TMSCarrier::find(shipmentTable.CarrierCode).CITCarrierType !=  CITCarrierCode::None)
        {
            FormButtonControl createlblbtn= formrun.design(0).controlName("CITCreateLabels");
            createlblbtn.clicked();
     
            if(InventLocation::find(shipmentTable.InventLocationId,false).CITWHSConfirmshipmentautomatically == NoYes::Yes)
            {
                //Call WHSShipmentDetails >> ConfirmShipment(ShipmentsActionTab>Shipments>btnOutboundShipConfirm)
                MenuFunction    menuFunction;
                Args            args1 = new Args();
                args1.record(shipmentTable);
                menuFunction = new MenuFunction(menuitemActionStr(WHSShipConfirm), MenuItemType::Action);

                if (menuFunction && menuFunction.checkAccessRights())
                {
                    menuFunction.run(args1);
                }
            }
        }
    }

No comments:

Post a Comment