Wednesday, January 15, 2014

Create a alert in AX 2012


void CreateAlert()
{
EventInbox inbox;
BomTable bomTable;
UserGroupList UserGroupList;
;
while select UserGroupList
where UserGroupList.groupId == ‘Admin’
{
inbox.initValue();
inbox.ShowPopup = NoYes::Yes;
inbox.Subject = “Creation of New Record”;
inbox.Message = “A New Item Id–>” + this.ItemId +” was Added by “+curuserid()+ ” under the BOM–>”+ this.BOMId;
inbox.AlertedFor = “BOM-> “+this.BOMId +”,” + curuserid();
inbox.SendEmail = false;

inbox.TypeId = classnum(EventType);
inbox.AlertTableId = tablenum(BOM);
inbox.AlertFieldId = fieldnum(BOM, ItemID);
inbox.TypeTrigger = EventTypeTrigger::RecordInsert;
inbox.CompanyId = curext();
inbox.InboxId = EventInbox::nextEventId();
inbox.ShowPopup = NoYes::Yes;
inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
inbox.UserId = UserGroupList.userId;
inbox.insert();
}


}

No comments:

Post a Comment