Показать сообщение отдельно
Старый 24.03.2008, 21:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
casperkamal: Sending alerts through code without error in Ax
Источник: http://casperkamal.spaces.live.com/B...CD63!376.entry
==============

 
 There was an article sometime back by Helmut on "sending alerts through code"(click to read the article), there was one problem with the code as helmut had quoted
 
    "* you will get an error in the alert form on the second tab"
 
  The error will not crop up if you use the following code....
 
void sendMessageToUsers()
{
    SysMailer           mail;
    UserInfo            UserInfo;
    EventInbox          inbox;
    EventInboxId        inboxId;
    ;
   
    select UserInfo where UserInfo.id == CurUserId();

    inboxId = EventInbox::nextEventId();
   
    inbox.initValue();
    inbox.ShowPopup     = NoYes::Yes;
    inbox.Subject       = "Testing alert via code";
    inbox.Message       = "Hello we are alerting";
    inbox.AlertedFor    = "This alert is just information no links are available";
    inbox.SendEmail     = false;
    inbox.UserId        = UserInfo.Id;
    inbox.TypeId        = classnum(EventType);
    //Give any table and field values
    inbox.AlertTableId  = TableNum(Address);
    inbox.AlertFieldId  = fieldNum(Address ,Name);
    inbox.TypeTrigger   = EventTypeTrigger::FieldChanged;
    inbox.CompanyId     = CurExt();
    inbox.InboxId       = inboxId;
    inbox.AlertCreatedDate = systemdateget();
    inbox.AlertCreateTime  = timeNow();
    inbox.insert();

}
 
 ......  Alert plz Alert


Источник: http://casperkamal.spaces.live.com/B...CD63!376.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.