Home > Ax Technical > Sending alerts through code without error in Ax

Sending alerts through code without error in Ax

 
 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();
}
 
 …… Auto Alert plz Alert Smile
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: