Home Analyst Portal

Custom Task to update enums on CR

Valerie_SirouxValerie_Siroux Customer IT Monkey ✭

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?


<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));&nbsp;</div><div>		&nbsp;</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>&nbsp;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>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },</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>&nbsp; &nbsp; &nbsp; &nbsp; type: "json",</div><div>&nbsp; &nbsp; &nbsp; &nbsp; transport: {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; read: {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url: "/api/V3/Enum/GetList/",</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data: { id: "195a0e62-41c0-f1db-8261-7b796401974a" },</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type: "GET"</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; },</div><div>&nbsp; &nbsp; &nbsp; &nbsp; schema: {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; model: {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fields: {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Id: { type: "string" },</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Text: { type: "string" }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; });</div><div>});&nbsp;</div>


  • merlenette_jonesmerlenette_jones Member Advanced IT Monkey ✭✭✭

    Can you paste your code in a text file. The format is off and hard to make sense of. 

  • Valerie_SirouxValerie_Siroux Customer IT Monkey ✭

    Pasted it into this text file.
  • seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
    edited January 2017
    Looks to me like you are saving 'this.ImplPlanValue' to a string into the Id field rather than as the actually ID value:

    <div><pre class="CodeBlock"><code>viewModel.set("C_ImplementationPlan", {
       Id: "this.ImplPlanValue"
    I think you actually want to save the real value there:
    viewModel.set("C_ImplementationPlan", {
       Id: this.ImplPlanValue
Sign In or Register to comment.