Custom Task to update enums on CR
I created a custom task to fill in some fields.
Most of the fields are updated correctly after clicking on Apply.
But my enums are not being updated.
On my custom task, I can select the enum values.
But after click OK, and applying and refreshing the form, the values are not updated.
These are custom enums. I used this approach before, but probably have made a mistake this time.
I can update these directly on the form without any issues.
But we want to enforce users to update the fields when changing the CR status !
Also, can I enforce the "apply" to happen automatically? So users can see their change immediately?
Thanks!
<div>app.custom.formTasks.add('ChangeRequest',"Test Valérie", function (formObj, viewModel) {</div><div> // Use require to load the HTML template</div><div> require(["text!/CustomSpace/templates/CR_CABApproval.html"], function(template) {</div><div> </div><div> cont = $(template);</div><div> </div><div> var vm = pageForm.viewModel;</div><div> var workItem = JSON.parse(JSON.stringify(vm)); </div><div> </div><div> //Create a viewmodel to handle the UX </div><div> var _vmWindow = new kendo.observable({</div><div> SchedStartDate: vm.ScheduledStartDate,</div><div> SchedEndDate: vm.ScheduledEndDate,</div><div> CommPlan: vm.C_CommunicationPlan,</div><div> RiskPlan: vm.RiskAssessmentPlan,</div><div> ImplPlanDataSource: templateImplPlanDataSource,</div><div>ImplPlanValue: viewModel.C_ImplementationPlan.Id,</div><div> <span style="font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;"> </span><span style="font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">okEnabled: true,</span></div><div> saveStatus: function () {</div><div> viewModel.set("C_ImplementationPlan", { Id: "this.ImplPlanValue" });<br></div><div> <span style="font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">viewModel.ScheduledStartDate = this.SchedStartDate;</span></div><div> viewModel.ScheduledEndDate = this.SchedEndDate;</div><div> viewModel.C_CommunicationPlan = this.CommPlan;</div><div> viewModel.RiskAssessmentPlan = this.RiskPlan;</div><div> },</div><div> okClick: function () {</div><div> this.saveStatus();</div><div> </div><div> customWindow.close();</div><div> },</div><div> cancelClick: function () {</div><div> customWindow.close();</div><div> } </div><div> });</div><div> </div><div> //Create the kendo window</div><div> customWindow = cont.kendoWindow({</div><div> title: "Approve Change",</div><div> resizable: false,</div><div> modal: true,</div><div> viewable: false,</div><div> width: 1000,</div><div> height: 1400,</div><div> close: function () {</div><div> </div><div> },</div><div> activate: function () {</div><div> // On window activate bind the view model to the loaded template content</div><div> kendo.bind(cont, _vmWindow);</div><div> }</div><div> }).data("kendoWindow");</div><div> </div><div> //Now open te window</div><div> customWindow.open().center();</div><div> });</div><div> </div><div> var templateImplPlanDataSource = new kendo.data.DataSource({</div><div> type: "json",</div><div> transport: {</div><div> read: {</div><div> url: "/api/V3/Enum/GetList/",</div><div> data: { id: "195a0e62-41c0-f1db-8261-7b796401974a" },</div><div> type: "GET"</div><div> }</div><div> },</div><div> schema: {</div><div> model: {</div><div> fields: {</div><div> Id: { type: "string" },</div><div> Text: { type: "string" }</div><div> }</div><div> }</div><div> }</div><div> });</div><div>}); </div>
Answers
Can you paste your code in a text file. The format is off and hard to make sense of.
Pasted it into this text file.
I think you actually want to save the real value there: