85) COC of the Form method

 /// <summary>

/// The <c>AvaInventTransferOrdersFrm_Extension</c> contains the TransMountain eventing logic for the <c>InventTransferOrders</c> form<c>InventTransferOrders</c> form control.

/// <summary>

[ExtensionOf(formStr(InventTransferOrders))]

final class AvaInventTransferOrdersFrm_Extension

{  

    private EntAssetWorkOrderLine   callerAvaWorkOrderLine;

    private AvaWorkOrderTransferOpenMode AvaWorkOrderTransferOpenMode;

    private InventTransferTable avaInventTransferTableLookup;


    /// <summary>

    /// Init method to check the Args dataset.

    /// FDD :- EXT_004_TrackItemShipment

    /// </summary>

    public void init()

    {

        if (this.args().parmEnumType() == enumNum(AvaWorkOrderTransferOpenMode))

        {

            AvaWorkOrderTransferOpenMode = this.args().parmEnum();

        }

        else

        {

        }

        if (this.args())

        {

            switch  (this.args().dataset())

            {

                case tableNum(EntAssetWorkOrderLine):

                    callerAvaWorkOrderLine = this.args().record();

                    break;

            }

            if (this.args().lookupRecord() && this.args().lookupRecord().tableId == tableNum(InventTransferTable))

            {

                avaInventTransferTableLookup = this.args().lookupRecord() as InventTransferTable;

            }

        }

        next init();


        this.avaEnableDisableForWorkOrder();

        

    }


    public AvaWorkOrderTransferOpenMode parmAvaWorkOrderTransferOpenMode()

    {

        return AvaWorkOrderTransferOpenMode;

    }


    public InventTransferTable parmAvaInventTransferTableLookup()

    {

        return avaInventTransferTableLookup;

    }


    public void run()

    {

        next run();

        if (this.args().parmEnumType() == enumNum(AvaWorkOrderTransferOpenMode))

        {

            this.viewOptionHelper().setViewOption(FormViewOption::Details);

        }

    }


    /// <summary>

    /// To Store work orderline .

    /// FDD :- EXT_004_TrackItemShipment

    /// </summary>

    public EntAssetWorkOrderLine parmAvaCallerWorkOrderLine()

    {

        return callerAvaWorkOrderLine;

    }


    /// <summary>

    /// Check caller and it true enable and disable the fields.

    /// FDD :- EXT_004_TrackItemShipment

    /// </summary>

    public void avaEnableDisableForWorkOrder()

    {

       

        var inventTransferTableDS = this.dataSource(formDataSourceStr(InventTransferOrders, InventTransferTable)) as FormDataSource;

        var AvaEntAssetWorkOrderLineViewDS = this.dataSource(formDataSourceStr(InventTransferOrders, AvaEntAssetWorkOrderLineView)) as FormDataSource;

        InventTransferTable inventTransferTableCursor = inventTransferTableDS.cursor();

     

        if (this.parmAvaCallerWorkOrderLine() || inventTransferTableCursor.AvaWOrkOrderTable)

        {

            inventTransferTableDS.object(fieldNum(InventTransferTable, AvaWorkOrderTable)).visible(true);

            inventTransferTableDS.object(fieldNum(InventTransferTable, AvaWorkOrderTable)).allowEdit(false);

         //   inventTransferTableDS.object(fieldNum(InventTransferTable, InventLocationIdFrom)).allowEdit(false);

          //  inventTransferTableDS.object(fieldNum(InventTransferTable, InventLocationIdTo)).allowEdit(callerAvaWorkOrderLine.functionalLocation().InventLocationId == "");

            AvaEntAssetWorkOrderLineViewDS.object(fieldNum(AvaEntAssetWorkOrderLineView, ObjectId)).visible(true);

            AvaEntAssetWorkOrderLineViewDS.object(fieldNum(AvaEntAssetWorkOrderLineView, JobTypeId)).visible(true);

            AvaEntAssetWorkOrderLineViewDS.object(fieldNum(AvaEntAssetWorkOrderLineView, JobVariantId)).visible(true);

            AvaEntAssetWorkOrderLineViewDS.object(fieldNum(AvaEntAssetWorkOrderLineView, FunctionalLocationId)).visible(true);

            if (!this.parmAvaCallerWorkOrderLine())

            {

                AvaEntAssetWorkOrderLineViewDS.allowCreate(false);

            }

        }

        else

        {

            inventTransferTableDS.object(fieldNum(InventTransferTable, AvaWorkOrderTable)).visible(false);

            AvaEntAssetWorkOrderLineViewDS.object(fieldNum(AvaEntAssetWorkOrderLineView, ObjectId)).visible(false);

            AvaEntAssetWorkOrderLineViewDS.object(fieldNum(AvaEntAssetWorkOrderLineView, JobTypeId)).visible(false);

            AvaEntAssetWorkOrderLineViewDS.object(fieldNum(AvaEntAssetWorkOrderLineView, JobVariantId)).visible(false);

            AvaEntAssetWorkOrderLineViewDS.object(fieldNum(AvaEntAssetWorkOrderLineView, FunctionalLocationId)).visible(false);

          

        }

    }


}

Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++