10

I tried the following but the warning still appears in the middle of the window:

myMsg = $messages.registerWarning("myTitle","myDesc",null, true);

myMsg .doArchive();
myMsg .dispose();

Registering a 'question' then archiving works fine (the question disappears).

My code snippet works in Tridion 2013 (no SP)

8

The issue is with your 4th parameter that you are passing to $messages.registerWarning...

$messages.registerWarning("myTitle", "myDesc", null, true); // true is for isModal

This is essentially making your warning as a modal that requires user interaction, and you wont be able to the doArchive and dispose on it until after the user has clicked the button. Setting this option to false will allow it to work just like a notification where the message will appear at the top right of the screen, and will be disposable without having the user to click anything.

$messages.registerWarning("title","desc",null, false)
$messages.getActiveMessages().forEach(function (message) {
    message.doArchive();
    message.dispose();
});

Hope that helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.