Thursday, October 31, 2024

Field auditing

https://docs-previous.pega.com/case-management/87/extension-point-field-level-auditing

DT - pyFieldLevelAudit : Example : Append to .pyAuditFields -> set .pyPropertyName "pyID"

Packaging
  • A full class of a case type with enabled field-level auditing, for example FLAudit-PegaProjMgmt-Work-UserStory-Epic
  • A class group of a class with enabled field-level auditing, for example FLAudit-PegaProjMgmt-Work
  • DB table instances of the class 'FLAudit-PegaProjMgmt-Work'
Extension point:
  • Create property in FLAudit- class. On the new property form, in the Additional configuration options section, select the Optimize for reporting and Optimize for reporting on descendant classes checkboxes.
  • Save as FLAudit-.pySave activity to FLAudit-<WorkPool> class. Refer Param.ContextPage (for WorkPage context)
Declare trigger -> Queue processor


History (History-Add activity method, AddHistory activity, flow connector shape)
Manage case history writes using decision tree : FilterHistory
FilterHistory application setting : WRITE_NONE/WRITE_SOME/WRITE_ALL
WRITE_NONE - All ootb history writes will be skipped
WRITE_SOME - FilterHistory decision table on the casetype class is considered



Saturday, October 26, 2024

SOLID

 When developing an OO design you should strive to be SOLID.

  1. Single Responsibility
  2. Open/Closed
  3. Liskov Substitution
  4. Interface Segregation
  5. Dependency Inversion
Liskov substitutionif class A is a subtype of class B, we should be able to replace with without disrupting the behavior of our program.
Interface segregationlarger interfaces should be split into smaller ones. By doing so, we can ensure that implementing classes only need to be concerned about the methods that are of interest to them.
Dependency Inversion: The principle of dependency inversion refers to the decoupling of software modules. This way, instead of high-level modules depending on low-level modules, both will depend on abstractions.



Validation

 1) Page-Validate : Validates all properties on the Step page - Mode, Table values, length..etc

2) Property-Validate : Edit-validate rule and/or required. We can list multiple properties.

3) Edit-validate : Referenced in properties, activity (Property-validate) and Validate rules.

  • Client side : If you select the option in the harness level (client side), certain OOTB edit validate has the corresponding javascript code (pega_validators.js). By this way it is working as the client side. But for the custom edit validates which was created as part of the application, it definetly works a server side validation.

      1. Create and test your edit validate rule.
      2. Associate the edit validate rule with a property.
        1. Open the rule form of a property.
        2. On the Advanced tab, under the Use Validate field, select the edit validate rule.
      3. Create and test a JavaScript function that performs the same validation test as the edit validate rule, and has the same name. Follow the structure used in the standard text file rule webwb.pega_validators.js. For example, if you have associated the property with a IsNotFutureDateTest validate rule that checks if the date falls in the future, you need to create a JavaScript function by the same name such as:/* IsNotFutureDateTest */var ruleEditValidate_notFutureDateTest = new validation_ValidationType("notfuturedatetest", ruleEditValidate_isNotFutureDate);ruleEditValidate_notFutureDateTest.addEventFunction("onchange", ruleEditValidate_isNotFutureDate);
      1. Save the JavaScript in a text file rule in your application RuleSet.
      2. Enable client-side validation by clicking the Enable Client Side Validation check box on the Advanced tab of the harness form. For best results use JSP tags and the SmartFrames format for the harness.
      3. Add the text file rule containing the JavaScript function on the Scripts and Styles tab of each harness that can present the field as an input field, that is, in read-write mode.

  •   Edit validate processing operates after edit Input processing and never alters the property value.

 4) Validate (Rule-Obj-Validate): Referenced on FlowAction or Activity.


 

Thursday, October 10, 2024

CSS classes

 https://support.pega.com/discussion/helper-classes-achieve-complex-forms-using-2-column-3-column-inline-wrapping-templates

  1. flex-cell-half
  2. flex-cell-2
  3. flex-cell-3
  4. flex-space-1
  5. flex-space-2

1.  flex-cell-half

This helper class can be used to size the field to half the width of a column.

2.  flex-cell-2

This helper class can be used to make the field occupy 2-columns. In 2-column-inline wrapping template, this helper class can be used to make a field occupy entire width of the row

In 3-column-inline wrapping template this helper class makes a field occupy two columns completely, thus letting only one field in the last column.

3.  flex-cell-3

This helper class can be used only in 3-column inline-wrapping template to make a field occupy entire row.

4.  flex-space-1

This helper class can be used to give a right spacing of 1 column to a field.

5.  flex-space-2

This helper class can only be used in 3-column inline wrapping template, to give right spacing of 2-columns to a field.