app.custom.formTasks.add('Incident', "Change Status to Awaiting Outside Resource", function (formObj, viewModel) { console.log(formObj); //use requirejs to load the template first require(["text!/CustomSpace/templates/changeStatusComment.html"], function (template) { //make a jQuery obj cont = $(template); //create a view model to handle the UX var _vmWindow = new kendo.observable({ comment: "", okEnabled: false, charactersRemaining: "4000", textCounter: function () { var maximumLength = 4000; var val = this.comment.length; (val > maximumLength) ? this.comment.substring(0, maximumLength) : this.set("charactersRemaining", maximumLength - val); (val > 0) ? this.set("okEnabled", true) : this.set("okEnabled", false); }, saveStatus: function () { //set new status viewModel.Status.set("Name", "Pending"); viewModel.Status.set("Id", "b6679968-e84e-96fa-1fec-8cd4ab39c3de"); //set action log var newActionLog = { EnteredBy: session.user.Name, Title: localization.Analyst + " " + localization.Comment, IsPrivate: false, EnteredDate: new Date().toISOString().split(".")[0], LastModified: new Date().toISOString().split(".")[0], Description: this.get("comment"), Image: app.config.iconPath + app.config.icons["comment"], ActionType: "AnalystComment" } //beta method actionLogModel.push(newActionLog); }, okClick: function () { this.saveStatus(); customWindow.close(); }, cancelClick: function () { customWindow.close(); } }); //create the kendo window customWindow = cont.kendoWindow({ title: "Change Status", resizable: false, modal: true, viewable: false, width: 500, height: 300, close: function () { }, activate: function () { //on window activate bind the view model to the loaded template content kendo.bind(cont, _vmWindow); } }).data("kendoWindow"); //now open the window customWindow.open().center(); }); });