Start a tasklet from code

Posted by: laurentl in tasklet on Print PDF

Sometimes, you need to start a tasklet from code. Like for instance, you need to start the synchronization tasklet if the data is missing or if you want to show a button that will start a specific "task".

 To do so, actually you do not start the tasklet directly, what you do is first define in the userrole an action that is pointing to the tasklet or the orchestration that your button/menu item should start.

<tasklet…
    <actions>
        <action name=”Synchronization”…
...

Then from your tasklet when the user is clicking on the button/menu item:

// Find all actions declared in the userrole for this tasklet instance that have the name:
ActionCollection actions = this.Actions.SelectByName("Synchronization");

// execute the first one if there is one and if it can be executed (if all required input mappings are ok)

if (actions.Count > 0 && actions[0].IsAvailable)
{
    actions[0].Invoke();
}

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