chain of commands with different controls







 [ExtensionOf(formControlStr(SalesTable,WhatsAppNotification))]

final class BA_UnifonicOrderSendService_Extension

{

    public void clicked()

    {

        FormControl formButtonControl = any2Object(this) as FormControl;

        FormDataSource formDatasource = formButtonControl.formRun().dataSource(tableStr(SalesTable));

        SalesTable salesTable = formDatasource.cursor();

        next clicked();

        info(strFmt("%1",salesTable.SalesId));

       // BA_SendNotificationToWhatsApp sendService = new BA_SendNotificationToWhatsApp();


       // sendService.sendNotificationsToWhatsApp();

    }


}


// second chain of command


/// <summary>

///This class is used to update the delivery status in salestable

/// </summary>

[ExtensionOf(formControlStr(InventOnhandReserve,ReserveNow))]

final class BA_onModifiedReservation_Extension

{

    /// <summary>

    /// This method is used to update the BA_DeliveryStatus in SalesTable.

    /// </summary>

    /// <returns>It will update the delivery status in salestable</returns>

    public boolean modified()

    {

        SalesTable salesTable;

        SalesLine  salesLine,salesLineLoc;

        real       onOrder;

        

        boolean ret = next modified();

       

        FormRealControl callerButton = any2Object(this) as FormRealControl;

        FormRun formRun              = callerButton.formRun();

        salesLineLoc                 = formRun.args().record();

       

        while select salesLine

            where salesLine.SalesId == salesLineLoc.salesId

        {

            onOrder = salesLine.onOrderInSalesUnit();

            if (onOrder)

            {

                select firstonly forupdate salesTable

                    where salesTable.SalesId == salesLineLoc.salesId;

                ttsbegin;

                salesTable.BA_DeliveryStatus = NoYes ::Yes;

                salesTable.update();

                ttscommit;

                break;

            }

            else if (onOrder == 0)

            {

                select firstonly forupdate salesTable

                    where salesTable.SalesId == salesLineLoc.salesId;

                ttsbegin;

                salesTable.BA_DeliveryStatus = NoYes ::No;

                salesTable.update();

                ttscommit;

            }

        }

        return ret;

    }


}


// formdatafieldstr chain of command

[ExtensionOf(formDataFieldStr(SalesTable,InventDim,WMSLocationId))]

final class ARF_LocationAddition_Extension

{

    public void modified()

    {

        ARFDispatchTrackOrders  dispatchTrackOrders;

     

        FormDataObject formDataObject = any2Object(this) as FormDataObject;

        FormDataSource fds,fds1;

        fds = formDataObject.datasource();

        FormRun formRun = fds.formRun();

        fds1 = formRun.dataSource(tableStr(SalesTable));

        SalesTable salesTable;

        salesTable = fds1.cursor();

      

        next modified();

      

        select firstonly dispatchTrackOrders where dispatchTrackOrders.ARFSalesId == salesTable.SalesId;


            if (!dispatchTrackOrders)

            {

                ttsbegin;

            dispatchTrackOrders.ARFSalesId = salesTable.SalesId;

                dispatchTrackOrders.Processed = false;

                dispatchTrackOrders.insert();

                ttscommit;

            }

            else if(dispatchTrackOrders)

            {

                ttsbegin;

                dispatchTrackOrders.selectForUpdate(true);

                dispatchTrackOrders.Processed = false;

                dispatchTrackOrders.doUpdate();

                ttscommit;

            }

        }


}

Comments

Popular posts from this blog

how to post trade agreement journals automatically using x++ code

How to Create a wizard in x++ d365

x++ code to submit and approve and reject the invent movement workflow in d365 F&O