Question & Answer
Question
How to auto-populate a date/time field on a Case page with current date/time value?
Answer
On a case page,
1) Create a Datetime property in Case Manager solution.
2) Place a Script Adapter on the page
3) Wire the "Send new case info" event to Script Adapter.
5) Use the sample script below (for script adapter) to load the default
date(today's date) in the property control.(Load widget logic) .
6) When the page load, you will notice datetime field is populated with current date/time.
Here is the sample code, the datetime field on my test page is called "timetest",
require(["icm/model/properties/controller/ControllerManager"], function(ControllerManager) {
var collectionController = ControllerManager.bind(payload.caseEditable);
var invDateController=collectionController.getPropertyController
("AC_datetest");
var currentDate = new Date();
// Set the controller attributes.
invDateController.set("value",currentDate);
pstate.set("value",pstatevalue);
}
return payload;
Was this topic helpful?
Document Information
Modified date:
17 June 2018
UID
swg21976756