Skip to main content
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.

Default property values

When a user creates a case, you might want to set default values for properties that are already known to reduce the time that users spend entering data. For example, in an insurance claim case, you can set the default date of loss to today's date. 

In other cases, you might want to use data from the operator record, such as the user's organization unit, to initiate property values. For example, in a travel booking application, you set the First Name and Last Name fields to the first and last name on the user operator record. In addition, you set the Date of Travel field to today's date and the Date of Return field to seven days in the future.

field-examples-2

Setting default values can also be useful in a development environment. When you iteratively run a process to test your changes, you can save time by using a data transform to enter default values in required fields.

Data initialization page

You can edit default values in App Studio by using the Data initialization page on a case type's Settings tab. When you create a case, you can select properties to set default values and you can assign exact values to each property. You can also set properties to another property within the same case type. Available actions and properties are shown in drop-down menus. In the example below, three data initializations are configured to perform specific actions when a case is created: 

  • Subscribe to notifications.
  • Set the Description field to User create for order.
  • Set the Work Status field to Initial creation.
data-initialization
Note:  You configure more complex data initialization use cases in Dev Studio.

Data transforms for default property values

The Data initialization page updates the pyDefault data transform. It is best practice to use the Data initialization page when possible and use the pyDefault data transform for more complex default values. The first time that you create a view for your case type, Pega Platform™ creates the pyDefault and pySetFieldDefaults data transforms. When you create a new case, the pyDefault data transform is invoked to set the default values for that case.

Note: The pyDefault data transform invokes the pySetFieldDefaults data transform. The pySetFieldDefaults data transform is modified by the system when Views are being configured. System Architects should not modify the pySetFieldDefaults data transform as changes applied by the system during View configuration risk overwriting these changes.
pyDefaults and pySetFieldDefaults

For example, in the following image of the pyDefault configurations, the First Name (.FirstName) and Last Name (.LastName) fields are set to pyFirstName and pyLastName from the OperatorID clipboard page:

pySetFieldDefaults-first-last-names
Note: To reference the OperatorID data page, you must add an entry to the Pages & Classes tab. 
pySetFieldDefaults-pages-and-classes

For example, in the following image of the pyDefault configurations, the Date of Travel (.DateofTravel) field is set to the current date by using the @CurrentDateTime() function, and the Date of Return field is set to seven days from the current date through the @addCalendar(.DateOfTravel, "0", "0", "0", "7", "0", "0", "0") function. 

Note: For more information on these functions, see Building expressions with Expression Builder.
pySetFieldDefaults-travel-return-dates.png

Check your knowledge with the following interaction:


This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

100% found this content useful

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice