Forum Discussion

Arthy's avatar
Arthy
Ideator I
8 years ago

Sending notification from server events

We need to send notification on modification of an item type. We wrote server side event to get the modification details but are in need of C# API to send notification. Thanks..

7 Replies

  • You can develop all the .Net code you want in a regular Visual Studio project, and then put your binaries in the Aras installation. Just remember to include these in method_config. Then you can call methods in your binaries from Aras methods.
  • Hi Arthy, I've done something very similar to this (I think) and would be happy to help, but I need a few more details. Do you mean that you would like to send a notification via Innovator (i.e. the built-in Email or Notification feature) or do you have a specific external API that you need this to happen via, as Moramatte is alluding to. When you say that you want to be notified when an "item type" is being modified, do you mean that you want this to happen when any Item of a particular ItemType is modified, or when the ItemType Item itself is modified? Best, Mike
  • Thanks Moramatte and Mike for your reply, The requirement is when an item of a particular itemtype is modified, we have to notify relevant ARAS users using ARAS innovator's built-in notification through server side onbeforeupdate[to collect information before modification] and onafterupdate method[compare and send notification on respective modifications done]. Currently am not able to find an API for notification similar to the following[for email]: Item emailItem = this.newItem("EMail Message", "get"); emailItem.setProperty("name", " EventDeleteMessage "); emailItem = emailItem.apply(); bool sent = modified_item.email(emailItem, identityItem); Kindly get back on any further information needed. Thanks, Arthy
  • We do not want to send email as it will SPAM the users inbox. Hence we are looking for an option to just Notify the user, when they are login to ARAS. Thanks, Arthy
  • Hi Arthy, Notifications are of ItemType "Message" and to create one, you just perform an "add". Similar to email, you'll specify the identity that should receive the message. There are a couple of required properties (type, priority, acknowledge, target). Best, Mike
  • Hello Mike, I tried the following.. Item notifyItem = this.newItem("Message", "add"); notifyItem.setProperty("type", "Popup"); notifyItem.setProperty("priority", "5"); notifyItem.setProperty("acknowledge", "Always"); notifyItem.setProperty("target", "Administrators"); notifyItem = notifyItem.apply(); Item identityItem = this.newItem("Identity", "get"); identityItem.setProperty("name", "Innovator Admin"); identityItem = identityItem.apply(); bool sent = myCurrentItem.email(notifyItem, identityItem); But am not able to get things work. Thanks in advance for your guidance, Arthy
  • Hi Arthy, The issue you're running into is that the property target on the Message ItemType expects an ID of an Identity item, but only a name is being passed in. To resolve this issue, you can either hard-code in the ID of the Administrators Identity (notifyItem.setProperty("target", "2618D6F5A90949BAA7E920D1B04C7EE1");) or perform a short query to look up the ID of the Identity as in the example below.
    Item identity = inn.getItemByKeyedName("Identity", "Administrators");
    notifyItem.setProperty("target", identity.getID());
    Chris
    Christopher Gillis Aras Labs Software Engineer