Alert Creation

Hi all,

I have requirement like this.

When modifying the field,Altert has to be created aautomatically based on some condition.

Caan you please suggest me?

Suggest me plz.

You can make use of the Events available or you can add conditions from select(Query)…

Hi,

By standard you can set up alert when a field value is changed, created, deleted etc. You can do this by right clicking on a field and selecting Create alert rule.

Have you tried using the standard functionality?

Hi,

How can we execute this by writing x++ code.

Hi,

Here is a sample code for generating alerts -

void sendAlerts(EmplId _emplId, str _bodyMsg, ProjId _projId)
{

EventNotificationSync alert;
MenuFunction MenuFunction;

str dataSourceName;
;

dataSourceName = tablestr(ProjTable);
MenuFunction = new MenuFunction(menuitemdisplaystr(ProjTable), MenuItemType::Display);
alert = EventNotificationsync::newInfo(subjectMsg,
_bodyMsg,
headerMsg,
NoYes::Yes,
curext(),
ProjTable::find(_ProjId),
dataSourceName,
MenuFunction);

alert.parmUserId(_EmplId);
alert.create();
}

The above code will send an alert with project information.

You create a generic class and method similar to the above for generating alerts. In your form control’s modified method, call this generic method.

Hope this is clear. Please let us know if you have any queries.

Mr saju,

please check this code…

static void CreateAlertUsingCode(Args _args)
{
EventInbox inbox;
UserInfo UserInfo;
UserGroupList groupList;
usergroupinfo usergroupinfo;
;
select Name,generalInfo from UserInfo where UserInfo.id == curUserId();

while select * from groupList where
groupList.groupId ==“testing”
{
inbox.initValue();
inbox.ShowPopup = NoYes::Yes;
inbox.Subject = “This Alert For sales order creation”;
inbox.Message = “New sales order has been created by
some other one”;
inbox.AlertedFor = “This alert is just information no links
are available”;
inbox.SendEmail = false;
inbox.UserId = curuserid();
inbox.TypeId = classnum(EventType);

inbox.AlertTableId = tablenum(SalesTable);
inbox.AlertFieldId = fieldnum(SalesTable,SalesId);
inbox.TypeTrigger = EventTypeTrigger::RecordInsert;
inbox.CompanyId = curext();
inbox.InboxId = EventInbox::nextEventId();
inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
inbox.insert();

}
}