Home Analyst Portal

Set-Method on Datatype: Date

Lutz_KralLutz_Kral Partner IT Monkey ✭

Hi,

we have extended a WorkItem Class with the following with two attributes, one Datetime and one Boolean. This is the relevant part of the workitem.js.

{
  columnFieldList: [
    { DataType: "Boolean", PropertyDisplayName: "Triggername", PropertyName: "Trigger"},
    { DataType: "Date", PropertyDisplayName: "Actual Date", PropertyName: "SampleDate" , Disabled: true }
 ]
},

The following lines in the custom.js bound to the change event of the "Trigger" are working well (the view is refreshed and I see the new state):

var vm = pageForm.viewModel
if (vm.Trigger == true) {
       vm.Status.set("Id", "993e38ce-1ba5-24cc-028a-9c76666666553");
       vm.Status.set("Name", "Customstate");
}


Now I want to save the current date in the SampleDate field when the trigger is fired.

var vm = pageForm.viewModel
if (vm.Trigger == true) {
       vm.Status.set("Id", "993e38ce-1ba5-24cc-028a-9c76666666553");
       vm.Status.set("Name", "Customstate");
       var now = new Date();
       vm.set ("SampleDate", now);                
}

The date is displayed correctly when I save the form, but will not show immediately after clicking the checkbox, like the status field.

Can someone help me with this?

Thanks

Lutz

Sign In or Register to comment.