help me online user

static void sendMsgToOnlineUsers(Args _args)
{
Eventmsgbox msgbox;
EventmsgboxId msgboxId;
SysClientclientsessions1 clientsessions1;
;
while select clientsessions1
where clientsessions1.Status == clientsessions1tate::Running
{
msgboxId = Eventmsgbox::nextEventId();
msgbox.initValue();
msgbox.ShowPopup = NoYes::Yes;
msgbox.Subject = “Message aler”;
msgbox.Message = “Message testing from ax application”;
msgbox.SendEmail = false;
msgbox.UserId = clientsessions1.userId;
msgbox.msgboxId = msgboxId;
msgbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
msgbox.insert();
}
}

error is

Variable Eventmsgbox has not been declared.

plz help me

v v reddy

send message alert to online users in axapta

Hi Veera,

You have declared Eventmsgbox as msgbox and in the while loop , why are u using Eventmsgbox::newEvent…use msgbox instead of Eventmsgbox in the loop…

Thanks and Regards,

Kevin

THANK U

THANK U

static void sendMsgToOnlineUsers(Args _args)

{

Eventmsgbox :: msgbox

EventmsgboxId :: msgboxId

SysClientclientsessions1 clientsessions1;

;

while select clientsessions1

where clientsessions1.Status == clientsessions1tate::Running

{

msgboxId = Eventmsgbox::nextEventId();

msgbox.initValue();

msgbox.ShowPopup = NoYes::Yes;

msgbox.Subject = “Message aler”;

msgbox.Message = “Message testing from ax application”;

msgbox.SendEmail = false;

msgbox.UserId = clientsessions1.userId;

msgbox.msgboxId = msgboxId;

msgbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();

msgbox.insert();

}

}

BUT ANOTHER ERROR SYNTAX MISSING

Hello verra,

what is EventMsgBOX?

Is this a table or class or etc…?

Regards,

Ramya

TABLE

I AM SENDING THE MESSAGE FOR ONLINE USERS

ITS POSSIBLE HELP

hello,

I think there’s a problem with your table EventMsgBox, replace with you EventInBox, you can try the following code, it work on Dynamics AX 2009:

static void sendMsgToOnlineUsers(Args _args)
{
Eventinbox msgbox;
EventinboxId msgboxId;
SysClientSessions clientsessions1;
;

while select clientsessions1 where clientsessions1.Status == sessionstate::Running
{
msgboxId = Eventinbox::nextEventId();
msgbox.initValue();
msgbox.ShowPopup = NoYes::Yes;
msgbox.Subject = “Message d’alerte”;
msgbox.Message = “Message de test de l’application AX2009”;
msgbox.SendEmail = false;
msgbox.UserId = clientsessions1.userId;
msgbox.InboxId = msgboxId;
msgbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
msgbox.insert();
}
}

regards,

Hi,

The code you mentioned is wrong because of following reasons -

  • there is no standard AX object as ‘Eventmsgbox’.
  • From AX 4.0 onwards, ‘sending message to users’ functionality has been replaced with alerts.

Sending alerts was discussed many times in this forum with code example. Please search for them.

Hi,

Is it possible to send a message to offline user also.

Thanks

darshana