Skip to main content
search
Aras Innovator

Sticky Notes in Aras Innovator

By October 26, 2021July 16th, 2023No Comments

While using Aras, have you ever noticed the bell in the top right corner with an ever-present notification about a new Aras version? Although the usefulness of that message to most of the users of Aras is questionable, did you know that Notifications in Aras can be utilized to update users about many different things? Some of the most useful ways to use Notifications is to send out an announcement to all users that informs them of when the environment will be down for maintenance. This can be done by the administrator logging in and creating a new Notification record from the Notification Messages branch of the Table of Contents. I’m going to show you some additional functionality that builds on the basic Notification Message item and provides users the ability to create a reminder, or a sticky note, on a Part in the system. This should get you familiar with the Notification Message item and its parameters.

Notifications are an instance of the ItemType named Message. Because notifications are just an instance of an ItemType, a method can be used to create them. This allows Developers to write methods that create Notifications and hook them to different events and actions in Innovator, for example an action on a Part, on a workflow transition, or on the creation of an ECO, to name a few.

As an Aras Administrator or Developer, taking advantage of the Notifications ItemType will help reach out to users when something happens that needs their attention. Below I will talk about the most important properties of Notifications, and I will walk you through an example that creates a simple reminder or Sticky Note on a Part.

An Overview of the Notification Item

Before I get into the sample Sticky Note functionality, here is some information on the Notification item itself. Below is an overview and screenshots of the Notification ItemType and an explanation of some of its properties. There are two types of notifications, popup and standard, and users interact with them differently. The ‘popup’ type creates a popup window that displays the notification to the user. The ‘standard’ type creates a notification under the bell. The standard notification serves as link to a popup notification. In other words, a standard notification still has a popup, but it only is shown when you click on the notification inside the bell.

  • Type Field
    • The Type field has two different options standard or popup. A standard type will cause the bell in the top right to have red dot and increase the number on it. While the popup type will automatically create a popup with the notification when the page is refreshed or the user logs in.
    • It is important to note two nuances related to Popup notifications 1) a Popup notification does not add a new entry under the bell notifications and 2) the title property is not shown anywhere to the user. If using a Popup type, then the title property can be ignored.
  • Title Field
    • The Title field is what the notification will say inside of the bell drop down
      • The title for this notification is “Reminder about Part T09”
  • Target Field
    • The Target field is the Identity you want to send the notification to.
    • This field can only consist of one identity so be sure that all users you want to notify are within that identity.
  • Acknowledge Field
    • The Acknowledge field gives you the options of once or always
      • Setting the field to Once sets the notification to disappear when the user clicks the OK button within the notification
      • Setting the field to Always causes the notification to continue to remain in the list of notifications until the Exit button is clicked.
  • OK and Exit Button Fields
    • The Ok and Exit Buttons have two fields, Show and Label. Show is self-explanatory, if checked it will be shown inside of the notification popup for both popup and standard notifications, but what each button does is important to note.
      • The OK button clears the notification from the user’s bell if it’s set to Acknowledge Once
      • The Exit button just exits the user from the notification, but the notification remains inside of the bell
    • It is smart to label the buttons, so users understand what each does. For example, label the OK button to say “Clear” or “Clear Notification”.
  • Expiration Date
    • The date that the notification will be automatically removed
    • This property is useful for communicating a system maintenance window.
  • Custom HTML Field
    • The Custom HTML field is where you would write HTML to display inside of the notification popup window for both standard and popup notifications.

 

Here is an example of a Notification message and the resulting notification in the bell and what the user sees when the notification is opened.

By default, user notifications are set to refresh every 15 minutes. This setting can be changed to send notifications to the user quicker. This is done under a variable called “MessageCheckInterval”, which can be found under the Variables section in the Table of Contents. The value defaults to 900,000 milliseconds or 15 minutes, changing the value to 10,000 milliseconds will refresh the notifications every 10 seconds. This is a good value for testing, but not a value that should be used in a production environment.

Sticky Note Reminder Solution

Now that you have some foundational understanding of notification items, I’ll show you a simple application that implements them. This application will demonstrate an action that allows a user to create a sticky note reminder on a Part item. Once the reminder is created it will show up in the notification bell and can be cleared whenever the user chooses.

When the user clicks the action, a prompt will appear and ask the user to enter reminder text to associate with the sticky note related to the part.

Whatever is entered in this box will show up inside of the notification popup. Once the okay button is clicked the notification will show up inside of the bell on the users next login or on the next polling interval update. Clicking on the notification will open the popup and display the text entered in the reminder prompt.

Within the popup there are two buttons, “Clear Notification” and “Exit”. Clear Notification will clear the notification from the bell for good. Exit will close the popup window and the notification will stay inside of the bell. The X in the top right corner can also be used the same way as the Exit button.

Code:

To implement this functionality, I created 2 methods. One Client side to get all the information needed to include in the notification and one server side to create the notification. The client method is used to collect the reminder text and Part information. The server method creates a Notification Message with input from the client method.

/* *****************************************************************************
Method Name: RL_ReminderAction
Client Name: Razorleaf
Created By/Company: JacobDonovan/Razorleaf
Creation Date: 2021-10-08
Description:
gets info from user and calls server method RL_AddNotificationAction to create notification

Hooks:
Type:Part
Event:Action

Inputs:
Item selected to run the action against

Revisions:
Rev DateModified ByDescription
2021-10-08Jacob DonovanInitial creation
***************************************************************************** */

//debugger;

//gets information about part in order to pass to server method
var type = this.getType();
var name = this.node.getElementsByTagName(“item_number”)[0].innerHTML;

//creates prompt and gets text from user input
var reminderText = prompt(“Enter Reminder: “);
if (reminderText == null) {
return;
}

//gets information about user who called action
var myInnovator = new top.Innovator();
var userID = myInnovator.getUserID();

var passThis = “<reminder>” + reminderText + “</reminder><name>” + name + “</name><type>” + type + “</type><userID>” + userID + “</userID>”;

//calling server method to create notification
var inn = this.getInnovator();
var result = inn.applyMethod(“RL_AddNotificationAction”, passThis);
if (result.isError()) {
top.aras.AlertError(“There was an error adding the reminder. Error: ” + result.getErrorString());
return
}

To create the reminder action, hook this method to an action Named RL_Reminder with a Label Add Sticky Note. Set the action’s Type property to “Item”, Location property to “Client”, and Target property to “None”. This method will then pass all the information it gathers into the “RL_AddNotification” server method.

Then you’ll add this action to the Part ItemType. Navigate to the Part ItemType and then go to the Actions tab and add it.

The method below is a server method called from the above client method and it is used to create the Notification Item. For this method to execute successfully the user needs permission to create new Notification items. Since this is normally an admin function the method needs to run with escalated privilege. In this case, the method was designated to run as “Super User”. This allows the user the ability to create a notification. Since “Super User” privileges were granted in the method, it’s best practice to revoke them at the end of the method.

/* *****************************************************************************
Method Name: RL_AddNotificationAction
Client Name: Razorleaf
Created By/Company: JacobDonovan/Razorleaf
Creation Date: 2021-10-08
Description:
creates a reminder/sticky note on a part

Hooks:
Type:Notification
Event:none
Called by:called from client method RL_ReminderAction

Inputs:
<Item>
<reminder>ReminderText</reminder>
<name>name</name>
<type>type</type>
<userID>userID</userID>
</Item>

Revisions:
Rev DateModified ByDescription
2021-10-08Jacob DonovanInitial creation

***************************************************************************** */
string MethodName = “RL_AddNotificationAction”;

//***** GRANT IDENTITY PRIVILEGES
grantIdentityPrivileges(“Super User”);
//*******************************

try
{
//getting all the info about the part from the client method
string itemType = this.getProperty(“type”);
string itemName = this.getProperty(“name”);
string reminderText = this.getProperty(“reminder”);

//getting identity alias of the user who clicked the action
string userID = this.getProperty(“userID”);
Item user = this.newItem(“user”, “get”);
user.setProperty(“id”, userID);
user = user.apply();
user.fetchRelationships(“Alias”);
Item identity = user.getRelationships(“Alias”);
string notifyID = identity.getItemByIndex(0).getProperty(“related_id”);

//creating the notification label and notification content
//HTML is written with a style. Can be updated as wanted to fit needs
string label = “Reminder about” + ” ” + itemType + ” ” + itemName;
string html = “<h3>” + label + “<h3><h4 style=’text-align: center;’>” + reminderText + “</h4>”;

//creating notification
Item notifyItem = this.newItem(“Message”, “add”);
notifyItem.setProperty(“type”, “Standard”);
notifyItem.setProperty(“priority”, “5”);
notifyItem.setProperty(“acknowledge”, “Once”);
notifyItem.setProperty(“target”, notifyID);
notifyItem.setProperty(“title”, label);
notifyItem.setProperty(“show_ok_button”, “1”);
notifyItem.setProperty(“ok_button_label”, “Clear Notification”);
notifyItem.setProperty(“show_exit_button”, “1”);
notifyItem.setProperty(“exit_button_label”, “Exit”);
notifyItem.setProperty(“custom_html”, html);
notifyItem = notifyItem.apply();

return notifyItem;
}
finally
{
//**** REVOKE IDENTITY PRIVILEGES
revokeIdentityPrivileges();
//*******************************
}

You can now create a sticky note reminder on any part in the system and clear the reminder when you have resolved it. If you are a subscriber, then you can find more information about Notifications in the Aras Innovator 12 Configuring Solutions Guide. If you are not a subscriber then you can find more information in an Aras blog post here, https://community.aras.com/b/english/posts/aras-fundamentals-user-notifications. It is best practice to implement and evaluate new functionality in a test environment, be sure to test changes thoroughly before pushing to production. If you still find yourself running into questions or issues, our experienced Aras team at Razorleaf is ready to help you through the process, so don’t hesitate to reach out to us!

Close Menu