Reuse an existing Pega Questionnaire using App Studio
This article shows how to reuse an existing Pega Questionnaire rules using App Studio. I've also documented some of the behaviors observed when reusing/extending/customizing an existing questionnaire.
Pega Infinity version used: 24.2
Client use case
In Pega App Studio, citizen developers can build a questionnaire using a special case type called "Questionnaire".
In my client project, we build large questionnaires for each fiscal year, which are built as case types and run inside a parent case as a child case. In the subsequent fiscal year, instead of building a similar questionnaire from scratch, it is much more cost effective to reuse previous year's questionnaire and customize only where needed.
This can be achieved using Pega's App Studio.
Configurations
Step 1 - Login to Pega App Studio.
Step 2 - Create a new case type and enter a case name.
- IMPORTANT: be brief with the case name because this will be part of the class name (auto generated), which has a character length limit.
Step 3 - Expand the Advanced section and configure as below.
- Type="Questionnaire"
- Reuse assets from="Base"
- Note: this is the existing Questionnaire case type that we are reusing in this example. This already contains a set of question pages and question rules.
- Select Reuse case life cycle checkbox.
- Click Next.
Step 4 - Verify that the new case type FY2020 is created with existing question pages/questions from the Base case type.
Validations
Step 1 - Run it and verify.
- It creates a new case using the new case type (FY2020). All of the question pages and question rules are reused from the existing Base case type.
Step 2 - Inspect the class/rules (auto generated).
- A new “FY2020” class is created, but notice that there is no questionnaire-related rule is created because we’re reusing an existing questionnaire from the base layer.
Observations on Reuse/Extend/Customize
-
After creating FY2020 questionnaire from the Base case type, you can start making new changes for the FY2020-specific requirements. While you are doing this, system auto generates rules behind the scene that later can be verified in DEV Studio.
-
In the FY2020 case type, when we added a new question rule to an existing question page, which existed in the Base case type, it overrode the question page rule from the Base class to the FY2020 class. Going forward, any change to the question page rule in the Bass class would no longer reflect in the FY2020 case type.
-
Customizing an existing question from the Base class to the FY2020 class only changed the question rule in the FY2020 class. This did not customize the parent question page rule from the Base class. Any future change to the same question page rule in the Base case type would be still reflected in the FY2020 case type.
-
When we configured a WHEN visibility condition in the Base class, it was also available in the FY2020 case type.
-
When we added a question page from Library in the Case Types Designer, it reused the question page rule from the Base case type as is.
Additional notes
- Once a questionnaire case type is built, it can be launched (as a child case) by a parent case.
- If your client requests to hide all other menus in App Studio except the Case Type where the citizen developers configure the questionnaire, this article shows how to hide them - https://support.pega.com/discussion/hide-default-menus-pega-app-studio