Sunday, October 26, 2014

Alert New in AX 2012

// Alert  New in AX

class SendEventAlert
{
}
static void sendAlerts_ItemMaster(str   _bodyMsg,str _subject,ItemId _item/*, UBMModelDeatils   _ubmModelDetails*/)
{
    // commented by Sangeeth
    EventNotificationSync   alert;
    MenuFunction            MenuFunction;
    str                     dataSourceName;
    HcmWorkerRecId          _hcmWorkerId;
    UserId                  _user;
    ;


   // _hcmWorkerId         = SalesQuotationTable::find(_ubmModelDetails.QuotationId).WorkerSalesTaker;
    _user                = DirPersonUser::findWorker(_hcmWorkerId).User;

    dataSourceName  =   tablestr(InventTable);
    MenuFunction    =   new MenuFunction(menuitemdisplaystr(EcoResProductPerCompanyListPage), MenuItemType::Display);
    alert           =   EventNotificationsync::newInfo(_subject,
                                                _bodyMsg,
                                                _bodyMsg,
                                                NoYes::Yes,
                                                curext(),
                                                InventTable::find(_item),
                                                dataSourceName,
                                                MenuFunction);



    alert.parmUserId(_user);

    alert.create();
}
static void sendAlerts_ModelDetails(str   _bodyMsg,str _subject/*, UBMModelReqNo _modelReqNo*/)
{
    // commented by Sangeeth
    EventNotificationSync   alert;
    MenuFunction            MenuFunction;

    str                     dataSourceName;
    SecurityRole    _securityRole;
    SecurityUserRole    _securityUserRole;
    ;

    //dataSourceName  =   tablestr(UBMModelDeatils);
   //// MenuFunction    =   new MenuFunction(menuitemdisplaystr(UBMModelDeatils), MenuItemType::Display);
    //alert           =   EventNotificationsync::newInfo(_subject,
                                                //_bodyMsg,
                                                //_bodyMsg,
                                                //NoYes::Yes,
                                                //curext(),
                                                //UBMModelDeatils::find(_modelReqNo),
                                                //dataSourceName,
                                                //MenuFunction);



    select _securityRole
        where _securityRole.Name == 'Estimator';

    while select _securityUserRole
            where _securityUserRole.SecurityRole == _securityRole.RecId
    {
        alert.parmUserId(_securityUserRole.User);
        alert.create();
    }
}
static void sendAlerts_SalesQuote(str   _bodyMsg,str _subject, PurchRFQCaseId _rFQCaseId)
{

    EventNotificationSync   alert;
    MenuFunction            MenuFunction;

    str                     dataSourceName;
    SecurityRole    _securityRole;
    SecurityUserRole    _securityUserRole;
    ;

    dataSourceName  =   tablestr(PurchRFQCaseTable);
    MenuFunction    =   new MenuFunction(menuitemdisplaystr(PurchRFQCaseTable), MenuItemType::Display);
    alert           =   EventNotificationsync::newInfo(_subject,
                                                _bodyMsg,
                                                _bodyMsg,
                                                NoYes::Yes,
                                                curext(),
                                                PurchRFQCaseTable::find(_rFQCaseId),
                                                dataSourceName,
                                                MenuFunction);



    select _securityRole
        where _securityRole.Name == 'Estimator';

    while select _securityUserRole
            where _securityUserRole.SecurityRole == _securityRole.RecId
    {
        alert.parmUserId(_securityUserRole.User);
        alert.create();
    }
}
static void sendAlerts_SendbyDivisionManagers(str   _bodyMsg,str _subject/*,UBMTmpSalesForecastEntryForm   _TmpSalesForecastEntryForm*/)
{
    // commented by Sangeeth
    EventNotificationSync       alert;
    MenuFunction                MenuFunction;
    str                         dataSourceName;
    UserId                      _user;
    HcmPositionRecId            _salesExecutivePosition,_salesManagerPosition;
    HcmWorkerRecId              _SalesManager;
    //UBMSalesForecastEntryForm       _salesForecastEntryForm;

    ;
    //select firstonly _salesForecastEntryForm
        //where _salesForecastEntryForm.RecId == _TmpSalesForecastEntryForm.Parantrecid;
    //_user = DirPersonUser::findWorker(_salesForecastEntryForm.EmployeeId).User;
//
    //dataSourceName  =   tablestr(UBMSalesForecastEntryForm);
    //MenuFunction    =   new MenuFunction(menuitemdisplaystr(UBMSalesForecastEntryForm), MenuItemType::Display);
    //alert           =   EventNotificationsync::newInfo(_subject,
                                                //_bodyMsg,
                                                //_bodyMsg,
                                                //NoYes::Yes,
                                                //curext(),
                                                //_salesForecastEntryForm,
                                                //dataSourceName,
                                                //MenuFunction);



    alert.parmUserId(_user);

    alert.create();
}
static void sendAlerts_SendbyRegManagers(str   _bodyMsg,str _subject/*,UBMTmpSalesForecastEntryForm   _salesForecastEntryForm*/)
{
    // commented by Sangeeth
    EventNotificationSync       alert;
    MenuFunction                MenuFunction;
    str                         dataSourceName;
    UserId                      _user;
    HcmPositionRecId            _salesExecutivePosition,_salesManagerPosition;
    HcmWorkerRecId              _SalesManager;
    HcmPositionWorkerAssignment _hcmPositionWorkerAssignment;
    ;
    select _hcmPositionWorkerAssignment
        where _hcmPositionWorkerAssignment.Worker == Global::currentWorker();
    _salesExecutivePosition = HcmPositionHierarchy::findByPosition(_hcmPositionWorkerAssignment.Position).ParentPosition;
    _SalesManager = HcmPositionWorkerAssignment::findByPosition(_salesExecutivePosition).Worker;
    _user = DirPersonUser::findWorker(_SalesManager).User;

    //dataSourceName  =   tablestr(UBMSalesForecastEntryForm);
    //MenuFunction    =   new MenuFunction(menuitemdisplaystr(UBMTMPSalesForecastEntryForm), MenuItemType::Display);
    //alert           =   EventNotificationsync::newInfo(_subject,
                                                //_bodyMsg,
                                                //_bodyMsg,
                                                //NoYes::Yes,
                                                //curext(),
                                                //_salesForecastEntryForm,
                                                //dataSourceName,
                                                //MenuFunction);



    alert.parmUserId(_user);

    alert.create();
}
static void sendAlerts_SendbySalesExecutive(str   _bodyMsg,str _subject/*,UBMSalesForecastEntryForm   _salesForecastEntryForm*/)
{
    // commented by Sangeeth
    EventNotificationSync       alert;
    MenuFunction                MenuFunction;
    str                         dataSourceName;
    UserId                      _user;
    HcmPositionRecId            _salesExecutivePosition,_salesManagerPosition;
    HcmWorkerRecId              _SalesManager;
    //UBMTmpSalesForecastEntryForm    _ubmTmpSalesForecastEntryForm;

    ;
   // _salesExecutivePosition = HcmPositionHierarchy::find(_salesForecastEntryForm.Positionrecid).ParentPosition;
    //select _ubmTmpSalesForecastEntryForm
        //where _ubmTmpSalesForecastEntryForm.Parantrecid == _salesForecastEntryForm.RecId;
    //_SalesManager = HcmPositionWorkerAssignment::findByPosition(_salesForecastEntryForm.Positionrecid).Worker;
    //_user = DirPersonUser::findWorker(_SalesManager).User;
//
    //dataSourceName  =   tablestr(UBMSalesForecastEntryForm);
    //MenuFunction    =   new MenuFunction(menuitemdisplaystr(UBMSalesForecastEntryForm), MenuItemType::Display);
    //alert           =   EventNotificationsync::newInfo(_subject,
                                                //_bodyMsg,
                                                //_bodyMsg,
                                                //NoYes::Yes,
                                                //curext(),
                                                //_ubmTmpSalesForecastEntryForm,
                                                //dataSourceName,
                                                //MenuFunction);



    alert.parmUserId(_user);

    alert.create();
}
static void sendAlerts_UpdatedSalesPrice( str   _bodyMsg,str _subject,QuotationId _quotationId )
{
    // commented by Sangeeth
    EventNotificationSync   alert;
    MenuFunction            MenuFunction;
    HcmWorkerRecId          _hcmWorkerId;
    UserId                  _user;
    SalesQuotationTable     _SalesQuotationTable;
   // EnquiryNo               _enquiryNo;
    str                     dataSourceName;
    ;
    //_enquiryNo           = SalesQuotationTable::find(_quotationId).UBMRefEnquiryNo;
    //_hcmWorkerId         = SalesQuotationTable::find(_enquiryNo).WorkerSalesTaker;
    _user                = DirPersonUser::findWorker(_hcmWorkerId).User;
    dataSourceName  =   tablestr(SalesQuotationTable);
    MenuFunction    =   new MenuFunction(menuitemdisplaystr(SalesQuotationTableDetails), MenuItemType::Display);
    alert           =   EventNotificationsync::newInfo(_subject,
                                                _bodyMsg,
                                                _bodyMsg,
                                                NoYes::Yes,
                                                curext(),
                                                SalesQuotationTable::find(_quotationId),
                                                dataSourceName,
                                                MenuFunction);



    alert.parmUserId(_user);

    alert.create();
}

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...