Setting values to case content object properties for Add Case, Split Case, and Case Details

Draft comment:
This topic is shared by BAW, CP4BA. Last updated on 2025-03-13 12:15
You can set values to case content object properties by using JavaScript at authoring time.

You can dynamically set case content object properties, to which you bind UI views in your Add Case, Split Case, and Case Details human service pages, just like any other client-side human service variable that you add to your page. The following information shows the format for the various case property types.

While you author the custom client-side human service page in Workflow Designer, you can set the value of a case content object property as part of the bound view's on Load event or by other view that calls the view's setXXX method.

Table 1. For a single cardinality property
Data type Data By using
String var data = "Test String"; this.setText("Hello!"); or me.setData("World!");
Integer var data = 10; this.setValue(100); or me.setData(150);
Float var data = 12.5; this.setValue(3.14); or me.setData(6.28);
Boolean var data = true; this.setChecked(true); or me.setData(false);
Datetime var data = new Date(); this.setDate(new Date()); or me.setData(new Date(2018, 11, 24));
Table 2. For a multi cardinality property
Data type Data By using
String var data = ["Test String","Second String"] var data = [“Hello”,”World!”]; me.setData(data);
Integer var data = [10,20]; var data = [10,20]; me.setData(data);
Float var data = [12.5,24.5]; var data = [3.14,6.28]; me.setData(data);
Boolean var data = [true,false,false]; var data = [true,true]; me.setData(data);
Datetime var data = new Date() [multiple data, for example, new Date(2018, 11, 24),new Date(2018, 11, 25)]; var data = [new Date(),new Date(2018, 11, 24)]; me.setData(data);
Consider an example for a business object that has three members, Name, Age, and Phone Numbers.
Table 3. Data setting for the business object
Business object members Type Cardinality properties
Name String Single cardinality
Age Integer Single cardinality
Phone Numbers Integer Multi cardinality
Table 4. Value set for the business object
Data type Data By using
Object var data = [{"Name": {"displayName": "Name","value": "Joe"},"Age": {"displayName": "Age","value": 45},"PhoneNumbers": {"displayName": "Phone Numbers","value": {"listAllSelectedIndices": [],"items": [1234567890, 2468024680],"te":"I"}}}]; me.setData(data);
Note: For a multi cardinality property that is part of a business object, the value needs to be set as {"listAllSelectedIndices": [],"items": [10,20],"te":"D"}, where items represent the array of values, "listAllSelectedIndices" must be present as an empty array, and 'te' represents the template of the multi value UI control. The value needs to be set based on the property type namely as, I (capital i) for Integer, D for Float, S for String, DT for Datetime and B for Boolean.
Exercise caution when you set a value to a case content object property by using an on Load event.
  • Add Case: The value that you set overrides any default value that is set in the property.
  • Case Details or Split Case: The value that you set overrides any previous value that you might have set while adding the case.