Tasklet configuration

Posted by: laurentl in tasklet on Print PDF

There are two ways to make your tasklet "generic" and configurable from the UserRole.xml file. In this post I will explain the first method.  

 

To configure a tasklet "instance", locate the definition of this instance in the UserRole.xml file (search for the element).

In the tasklet element it is possible to add a element. This one can contain two different child elements:

- : used to localize your application, it consists of a set of childs that have a key attribute and a text attribute that you can request from your tasklet code

- : used to add simple configuration to your tasklet, it consists of a set of childs that have a key attribute and a value attribute that can also be requested from the tasklet code.  

 

The appSettings can be used to configure your tasklet when the configuration is "simple". If you need hierarchical configuration, you will need to have a "custom element" in your configuration (I will talk about custom configuration in another post).    

 

<configuration>

<labels>

<add key="myKey" text="the text to show"/>

</
labels>

<appSettings>

<add key="emailToSendTo" value="laurent@createitin.net"/>

</appSettings>

</configuration>

 

To request a label text from the tasklet code:

string myLabel = this.Configuration.Labels.GetValue("myKey", "defaultValue");

To request an appSettings value from the tasklet code:

string mySystemEmailAddress = this.Configuration.AppSettings.GetValue("emailToSendTo");

Be aware that the key attribute is case sensitive.
Comments (0)Add Comment

Write comment
You must be logged in to post a comment. Please register if you do not have an account yet.

busy