Dialogs from View/Grid

Mar 9, 2016 at 8:44 PM
First off... thanks for sharing this with.
I've enjoyed using this Alerter on forms.
I've used for multiple question.
Work fantastic.

I've been trying to get the scipt going from a Ribbon-button.
So I had to dynamicaly load the webresources.
All went fine... up to the callback.
There the getDialogArguments is 'undefined' in the alert-dialog.js in the method buttonClicked

What I need is a way in a View to ask the user for which records need to be processed... All the records, or the records in the current View, or just the selected record(s).
I have the code in place for each scenario... I didn't want three ribbon buttons... I wanted to use this modal dialog.

Did you have the Alert work in a View/Grid... or can you point me in a direction to have this work..? Thanks..!
createXMLHttpRequest = function () {
    if (window.XMLHttpRequest) {
        return new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        return new ActiveXObject('Microsoft.XMLHTTP')
    } else {
        _error("Could not create XMLHttpRequest on this browser");
        return null;
    // get the Alert script
    var httpRequest = createXMLHttpRequest();
    httpRequest.open("GET", Xrm.Page.context.getClientUrl() + "/webresources/mag_/js/alert.js", false);
    Alert.show("Which record do you need to process?", null,
        label: "All",
        callback: function () {
            Alert.show("All records have been processed", null, null, "SUCCESS", 500, 200);
        label: "Current View",
        callback: function () {
            Alert.show("Records in the current view have been processed!", null, null, "SUCCESS", 500, 200);
        label: "Selection",
        callback: function () {
            Alert.show("Only selected records have been processed", null, null, "SUCCESS", 500, 200);
        label: "None"
    }], "QUESTION", 500, 200);
Mar 11, 2016 at 12:35 PM
Found the problem.
It was my bad... the relative to the ClientGlobalContext.js.aspx was wrong... that's where getDialogArguments are set.
All done... works like a charm from Views as well.
Marked as answer by Liger on 7/5/2016 at 3:49 PM
Jul 5, 2016 at 10:49 PM
Hi, thanks for the feedback, glad to hear you got it working in the end. I've added some documentation now which describes how to use this from views/command bars, so you don't need to load the Alert.js library manually in your code. Also, I'm guessing you manually created the web resources with your own prefix etc? In this case there are several relative references to the other files, which you've probably already found need to be updated. I've also included this in the documentation. Thanks.
Marked as answer by Liger on 7/5/2016 at 3:49 PM