TEMPORARY WORK OBJECTS IN PEGA
As the name suggests, Temporary cases are work objects which are not permanent, i.e. they are not stored in the Database. They just remain in memory [Clipboard] and do not have any case ID associated with them. They are created and managed by a single operator who has initiated the case and cannot be routed.
Temporary work objects are highly recommended in many business scenarios because temporary work objects get stored in the database only when certain conditions are met hence helping in the maintenance of the database by not storing unnecessary data.
Let us consider the same case type we used in our previous Duplicate Search post.
Our requirement is that we need to store only the non-duplicate cases in our database and do not need those cases that are identified as duplicates. We can implement this requirement by using Temporary Objects and Persit Case shape to store the non-duplicate cases.
1. Open the required case type.
2. The temporary case can be enabled in two places. One, in the settings tab of the case design. Two, in the pyStartCase flow.
3. Go to the settings tab and under General category enable the Checkbox stating 'Create temporary case that is not saved until a 'Persist case' step is reached'.
4. Once this option is enabled and Saved, we can notice that the starter flow pyStartCase in PFEInsurance class has the settings for Temporary Object enabled.
5. To make this temporary work object permanent, we can use the Persist Case option in case management whenever it is desired to be persisted.
In our scenario, we intend to persist a case only when it is not a duplicate case. After the Duplicate Search step, we add Persist Case step so that only the non-duplicate cases are stored in the Database.
6. The persist case step should be next to the Duplicate search step.
7. Let's save and run the case to check its functionality.
8. Create a new case. Here we can see that a case ID is not generated for the case when we are in the Collect Policyholder details step.
9. Let us open the clipboard and observe the work page and assignment page.
10. In the work page, pyID and pzInsKey are blank and pyTemporaryObject is true.
11. In assign page, reference object related properties are blank.
12. Enter distinct data and submit the step. The duplicate search step determines that the case is not duplicate and proceeds to persist the case. The case ID will also be generated. Proceed the case to Resolve it.
13. In case the case created is a potential duplicate, the new case created will not persist and the case will resolve as Duplicate and the case details are not persisted in the Database.