How to display the custom message in SDL Tridion Message bar? - tridion

I want to display my custom message (Say for Ex: some message needs to display when Page is save event is triggered) in SDL Tridion CME Message bar. How to do this?

From an event system you can only display ERROR messages.
If your Event code throws an error the "Message" will be displayed in the Message bar.
For other type of messages you need to use Javascript/CM Extensions. You can find an example of an event system that shows a message here.

Nuno covered your options pretty well.
If you want to show a message from your JavaScript code, this is usually my starting point:
$messages.registerNotification("Hello world");
If you put this in your JavaScript code (or just paste it into a JavaScript console), it will show a blue bar with "Hello World" in it.
There are many types of messages, each of which shows up slightly differently. What I usually do if I need more than a notification is:
type $messages. in a JavaScript console in a browser where the web GUI is loaded
go through the list of relevant methods to see what looks most promising (they all start with register)
perform a text search on the source code for the method that I am looking for
This leads me to an example of how that method is used in the GUI already and is a great starting point for my own code.
Update
Alexander Klock recently wrote a thorough explanation of the message types available on his blog.

Related

Botium Box crawler test case failing on Watson Assistant buttons

I am using Botium Box crawler on a Watson Assistant skill.
The bot's initial statement includes a greeting and seven buttons.
Botium is generating test cases for each of the buttons, but the button-press does not generate the right response in Watson Assistant.
A generated case is below:
1.6.2.2.2.4_hello_Password
#bot
#me
hello
#bot
UTT_M1_HI-THERE!
#bot
BUTTONS Benefits|Badges, Explanation of Badges or Certificate of Completion|COVID-19|ID Cards - Order, View, Print, Return|Employment/Termination|Password|None of the above, enter search text
#me
BUTTON password|Password
#bot
(responds as if Watson Assistant received the word "BUTTON" rather than the "password" value in "Password"-labeled button)
The dialog node has child responses using conditions like:
input.text=="password" or input.text.contains("password")
The expected behavior in Watson Assistant for a button press is that the button text (not label) is passed to the button. In the Watson Assistant Try it Out panel I click "Password" and it sends the text "password".
The only way I can replicate the Botium behavior in Try it Out is to pass the literal text "BUTTON". Even if Botium sent input.text=="BUTTON password|Password" my condition should fire.
Am I using Botium Box crawler wrong, or is there a bug in the crawler?
Update: Other button-driven prompts work, such as "yes/no" button prompts. I wonder if there is a parsing problem because the buttons have very long labels with some special characters and punctuation.
The issue has to be fixed with the next release of the crawler package.
If you need this fix now, then we can update directly your trial instance.
You can get more detailed log by set the DEBUG=botium-* env variable. So in commandline it should look like this:
DEBUG=botium-* botium-cli crawler-run --entryPoints 'hello'
In this case you will get a log and very detailed log. You can reduce its size with using exitCriteria (e.g.: --exitCriteria 'Benefits' 'Badges') to exclude those path which work correctly.
We will investigate the detailed log, just send us please.

Alert-Banner Only works after refreshing page

Alert-Banner is applied in our clarity UI. It is triggered by error message and Alert-ERROR message type.
<alert-banner [message]="message" [type]="messageType"></alert-banner>
This alert only shows up after UI main page get refreshed.
Not sure if the way we use alert-banner is wrong - some settings that trigger page refreshed is missed in the alert-banner definition.
Or we should apply other alerts mechanism. reading around https://vmware.github.io/clarity/community
could not find an example pass varied "alert text" in.
Clarity doesn't have an <alert-banner> component. Did you check where it was defined?

Relating two shield UI ASP.NET Charts

I want to create two related Shield UI ASP.NET charts. When the users clicks on the first one, the data on the second one to be changed. I looked at the available events in my Visual Studio, however what i find are events related to the data binding, loading and so on. I also see there is a group of properties- ClientEvents. And for the SeriesClick event i declare the SeriesClickFunction. Which is located in my C# code:
protected void SeriesClickFunction() {
}
However when i run my application in debug mode and put a break on that function, it never gets triggered. Why is that? How could I actually take use of these events?
In the C# code module you may not place the ClientEvents functionality. What you need is to place it on the HTML source of your page. Here is one good example of how you may relate two charts in the manner you want:
https://demos.shieldui.com/aspnet/rangebar-chart/related-charts

Android Dialog dismiss using handler

I meet a stranger question,when I read the android GlobalAction source code,I find that it will start a dialog,but it add a judgement which will judge whether this dialog has been shown,if it was shown before,it will be dismissed and then show it.The stranger things is that it dismiss the dialog,than use Handler to send a message to create and show dialog again,I can't understand why it needs to send a handler message,I think it just calls dialog dismiss function.then calls show function,it no problem.The comment said:"Show delayed, so that the dismiss of the previous dialog completes",but I also can't understand the meaning,please someone help me explain it,Thanks a lot.
if (mDialog != null) {
mDialog.dismiss();
mDialog = null;
// Show delayed, so that the dismiss of the previous dialog completes
mHandler.sendEmptyMessage(MESSAGE_SHOW);
}
Many Android UI functions are themselves implemented using messages, and so do not complete immediately. When you call Dialog.dismiss(), Android queues a message that does the actual dismissing. The author of this code wants to ensure the dialog is actually dismissed before showing it again, and so she posts her own message, which will not run until after the one posted by Android.

IOErrorEvent Eluding Capture

I'm working on a Flex application that processes and displays small amounts of HTML, sometimes including images. I'm getting the HTML out of third-party RSS feeds. Sometimes, I see this in a pop-up window:
Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
The RSS URL is just fine, but there's apparently something in the downloaded HTML that's causing a problem. Since the application is meant to run as part of a non-interactive digital sign, anything that requires a click to continue is completely unacceptable. I don't care how useless or malformed a URL is; the app needs to ignore the problem without pestering the user.
Unfortunately, I'm having no luck trapping this event. I'm sprinkling calls like this liberally through the code:
[object].addEventListener(IOErrorEvent.IO_ERROR, handleIOError);
... where [object] is everything from the mx:Text object rendering the HTML to its mx:Canvas parent to the mx:Application top-level app, and handleIOError is a simple function that looks like this:
private function handleIOError(event:IOErrorEvent):void {
trace ("IO error occurred: " + event);
}
But so far, nothing; that bloody error keeps popping up in the Flash player. Does anybody have any insight as to where I'm going wrong?
Make sure you are putting the event on the right object. I haven't done a whole lot of remote loading in Flex, but in Flash, a hilarious and annoying quirk is that when you use the Loader class to load images, the object you need to put event handlers on is NOT the Loader itself, but a property of the loader called contentLoaderInfo.
Read the docs carefully on the objects you are using, a similar pitfall might be at play.
IOErrorEvent is not bubbled so you cant catch or control it if someone else is implementing it.
Please find out which third party component you are using and try to get source if its open source or read some documentation or ask support guys on how to turn off this alert.
For example, if I made RSS component for flex and on error if I displayed the alert, if you use my component, whatever you can do you cant turn off my error alert unless i have provided you a boolean switch to turn it off. So this is really a problem with who has written the code for this alert box. Whatever you do you will not be able to turn this thing off. Except reverse engineer, change the code and recompile it, but it should be legal.

Resources