K2 blackpearl’s Environment Fields are accessible through an IDE like K2 Studio or directly from the browser-based K2 Workspace. The values they contain are always of the String data type. What’s really magical about them is that they may be accessed at runtime by any workflow process and their values may be modified arbitrarily from outside of a process by an administrator. They differ from Activity- and Process-scope Data Fields in that these values are limited in scope to a specific workflow process and their values are compiled and deployed with the process.
These differences afford you, the developer, some amazing opportunities.
Let’s say that a workflow process sends e-mail traffic which contains a privacy statement at the bottom of the body of every outgoing message, and that the content of the message must be able to be changed as the business requires. You can meet these criteria handily by placing that text in an Environment Field and referencing the field in each of your e-mail events. The text is in one field only, so changes to the content will affect all of the messages, and the content can be changed arbitrarily by an administrator with sufficient access. Once the field is changed, the new text will appear with every new E-mail Event which references it — even in current process instances. And the best part? The content in Environment Fields is detached from your compiled solution, so you don’t have to recompile and redeploy the solution every time that text is modified.
An administrator can modify the Environment Field content through the K2 Workspace. To arrive at the Environment Fields, the administrator would enter the K2 Management Console, then navigate the tree from the root node as follows: {your root node} --> Environment Library --> Templates --> Environments --> {the proper environment} --> Environment Fields
.
Furthermore, you can perform Replace()
functions on the Environment Field content from within the E-mail Events. Let’s say you have an Environment Field which contains the following content: “Thank you for submitting your application to enroll as a provider for the [SystemName].” In the E-mail Event, you can pass the Field into a Replace() statement, to replace “[SystemName]” with other text — like, say, another Environment Field which contains the system name!
I’m hopeful you’re beginning to see what makes the Environment Field such a magical thing. It offers the benefit of consistency and accessibility without the need for redeployment — which means it can save a lot of time.