Code Sample
Xperience
>
API Reference
>
NoteItemAdd
>
Code Sample
SoapAction | n/a |
Input Name | NoteItemAdd |
Output Name | NoteItemAddResponse |
Input Namespace | n/a |
Group Name | Xperience |
Container | XP_MsgBus.xsd |
NoteItemAdd.cs
string id = Guid.NewGuid().ToString();
var note = new NoteItemAddRq_MType()
{
NoteItemAutoRmv = bool.FalseString,
NoteItemDesc = "Notification title text",
NoteItemDet = "Warning message goes here! Currently limited to 63 chars.",
// The notification Id. When ommitted the message Id is used.
NoteItemId = id,
EncapAppMsg = "1",
// The text to be shown below the notification. The link that is used for the callback
// function. If omitted, and the EncapAppMsg has a value, 'Process this notification'
// will be used by default. If omitted, and the EncapAppMsg is also omitted, 'Remove
// this notification' will be used by default.
AppLinkText = "Process my warning by clicking here!",
// Used to set the default icon and level of notification.
// The Custom selection allows the sender to specify a custom icon to display.
// All other selections will display a default icon, even if a custom icon is sent.
// If omitted, Custom will be used by default.
// Canonicals: Error, Warning, Info, Custom
NoteItemCategory = "Warning",
// Used to set the level of the system tray icon notification. Default will be an
// Interactive Information display represented by the Med canonical value, and the
// tray icon will be set to indicate that notifications are available. Low will display
// a small visual display with limited information, but the tray icon will be set to
// indicate notifications are available. None will not show any visualization,
// nor will the tray icon change from the current state however the notification
// will be logged in the notification history. (Notification quietly gets added to
// the notifications tab only.) High canonical value is for future usage that
// would be blocking the UI which would rarely be used and required coordination of
// consumer and provider. If omitted, Default Med is used.
// Canonicals: High, Med, Low, None
NoteItemNotType = "Medium",
// Base64 encoded image that can be used as a custom image in the notification in the
// notification tab and in the notification balloon if shown. This image will only
// be used if the NoteItemCategory is set to custom, even if an image is supplied
// in this property. If no image is supplied, and the NoteItemCategory is set to
// custom, Xperience will attempt to use the product's default image if available, or
// an internal generic image if not. The image should be 16X16 or 32x32 dimension
// and PNG, JPG, or BMP format. PNG is preferred due to the superior quality.
// Please be aware this is NOT .ico format. The term icon is used as a generic term.
NoteItemCustomIcon = Convert.FromBase64String(this.CreateBase64ImageFromResource("Demo.Images.Red.png"))
};
// NOTE!!!!! Using NoteItemAdd when communicating with the Hosted Message Bus
MessageOptions options = new MessageOptions();
options.DestinationRoutes.Add(
new Route()
{
User = new UserRoute()
{
UserName = "testuser1@dev.jha"
}
});
options.DestinationRoutes.Add(
new Route()
{
User = new UserRoute()
{
UserName = "testuser2@dev.jha"
}
});
DemoShowDetails encapMsg = new DemoShowDetails() { Id = Guid.NewGuid().ToString(), Description = "Information to display goes here." };
var note = new NoteItemAddRq_MType()
{
AppLinkText = "Click to see some details...",
EncapAppMsg = JackHenry.Xperience.MessageBus.Serializer.Serialize(encapMsg),
NoteItemAutoRmv = bool.FalseString,
NoteItemCategory = "Info",
NoteItemCustomIcon = noteIcon,
NoteItemDesc = "Demo Request",
NoteItemDet = "Click the link below to see details.",
NoteItemId = id,
NoteItemNotType = "High"
};
// NOTE!!!!! Our callback will be for the encapsulated message, not the actual note request!
ICallback callback = this.messageBus.Send(note, options).RegisterResponseHandler(this.SendDemoShowDetails);
private void SendDemoShowDetails(IMessageContext context)
{
if (context != null)
{
DemoShowDetailsResponse rs = context.DeserializeMessage();
}
}
NoteItemAdd.js
var request = new jackHenry.xperience.businessObjects.NoteItemAdd();
request.EncapAppMsg = "Sample Message";
request.NoteItemAutoRmv = "false";
request.NoteItemCategory = "Info";
request.NoteItemDesc = "Sample Note";
request.NoteItemDet = "Details";
request.NoteItemId = jackHenry.xperience.Guid.newGuid();
request.NoteItemNotType = "High";
sampleXPWebProductAngular.Helper.FillHeader(request);
var responseCallback = jackHenry.xperience.messageBus.send(request).registerResponseHandler(onAddNoteCallback);
Have a Question?
Have a how-to question? Seeing a weird error? Get help on
StackOverflow.
Register for the Digital Toolkit Meetup
where we answer technical Q&A from the audience.
Last updated Mon Apr 11 2022