I want to have a window pop up after a task is saved

I want the user to save a task and ifs its a certain task type (a custom field) then I need a popup window with the ID of the task on it like

https://www.whatever.com?id=TASK_ID

This window has info for the user to fill out on another system so I cant automate it.

I have found many places I can put this window.open() but no where that has access to the newly created task's ID.

I wanted to add it to the saveAndClose()  but it still doesn't have access to the task id.

Parents
  • Hi

    You could redirect the user to that URL after the save is completed by overriding the saveAndClose in your create.js controller:

       saveAndClose: function(){
            this.initiateSave(_.bind(function () {
                if (this.closestComponent('drawer')) {
                    app.drawer.close(this.context, this.model);
                } else {
                    app.navigate(this.context, this.model);
                }
                var url = "http://www.whatever.com?id="+this.model.id;
                window.open(url);
         }, this));
       },

    You need to add your condition on the task type, but you get the idea.

    Of course this is a bit "drastic" and potentially high maintenance because you're not extending the saveAndClose but overriding it.

    I've not done this myself and just quickly tested the theory (and it works), and there is probably a better way of doing this without overriding the entire method but it may be a starting point for you...

    FrancescaS

Reply
  • Hi

    You could redirect the user to that URL after the save is completed by overriding the saveAndClose in your create.js controller:

       saveAndClose: function(){
            this.initiateSave(_.bind(function () {
                if (this.closestComponent('drawer')) {
                    app.drawer.close(this.context, this.model);
                } else {
                    app.navigate(this.context, this.model);
                }
                var url = "http://www.whatever.com?id="+this.model.id;
                window.open(url);
         }, this));
       },

    You need to add your condition on the task type, but you get the idea.

    Of course this is a bit "drastic" and potentially high maintenance because you're not extending the saveAndClose but overriding it.

    I've not done this myself and just quickly tested the theory (and it works), and there is probably a better way of doing this without overriding the entire method but it may be a starting point for you...

    FrancescaS

Children