IBM Support

Case Manager, how to auto-populate a date/time field on a Case page

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;

[{"Product":{"code":"SSCTJ4","label":"IBM Case Manager"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Case Manager Builder","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"5.2.1;5.2.0","Edition":"All Editions","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
17 June 2018

UID

swg21976756