Create type-safe generic components similar to Case Management Framework
206
Views
2
Comments
New
Service Studio

Case Management Framework allows applications to extend itself by registering cases, statuses, etc via a public API (BootstrapCaseConfiguration). However, this API is not type-safe and requires converting from a static entity identifier to an entity identifier.

For example, in the following image a ClaimsConfiguration static entity is setup with the case configuration:


Then to configure the Case, we have to retrieve the static record, and populate the SetupData structure based on it. However the SetupData structure requires a CaseDefinitionId which is incompatible with the static entity:


The proposed "fix" is to use TextToIdentifier() which is not type-safe either.


Case Management Framework is just an example, but there are plenty of other needs in similar generic components. For example, a component that audits applicational events (e.g. payment failed, checkout completed, login, logout, etc) would have the events defined in a static entity at the application level, but would also define a generic API to audit those events. There's interest in making this component generic (foundational layer) but allowing it to be extended at each application with specific events to each application. This cannot be done currently in a type-safe manner.

Advantages of having type-safety would be reducing the human error, promoting the creation of generic components, and also helping the developer to select a correct value by suggesting type-compatible options like highlighted in the mockup below:


I wrote a 2-part article about this very same topic, part 2 is more relevant to this discussion: https://leonardo-monteiro-fernandes.medium.com/extending-static-entities-part-2-6f519b639982

In the article I discussed the need and proposed a solution to it, but my proposed solution has been broken by OutSystems on release 11.12 and we cannot use it anymore.

Regardless of the solution and proposed approach, the need still exists and an example of that is Case Management Framework itself, which would benefit from type-safety.

I totally agree with you @Leonardo Fernandes 

+1