Skip to main content

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 .pyDefault 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

Pega Platform provides two types of data transforms that you can use to automatically set default property values and page properties when you create a case: pyDefault and pySetFieldDefaults

Tip: As a best practice, use pySetFieldDefaults to set values for UI fields, and use pyDefault for properties not referenced in the UI. For example, configure pySetFieldDefaults to set the default value for the Reservation date field on a view to reserve a rental vehicle and configure pyDefault to set the default urgency for assignments for the case type.

The first time that you create a view for your case type, Pega Platform creates the pyDefault and pySetFieldDefaults data transforms. You can also create them manually. When you create a new case, the pyDefault data transform is invoked by the pyStartCase process. PyDefault then invokes the pySetFieldDefaults data transform. 

pyDefaults and pySetFieldDefaults

For example, in the following image of the pySetFieldDefaults 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 pySetFieldDefaults 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.

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