I want to populate the default values (in GUI / FTL) of my task based on TaskContext.
I'm my case, I want to show all available DeploymentProjects for this plan (as used by task).
This can be easily achived inside of my task using : deploymentProjectService.getDeploymentProjectsRelatedToPlan(parentPlanKey) ... since I have access to the TaskContext.
I'm not however sure how to achive this in my Configuration Class .. which extends from AbstractTaskConfigurator.
Thanks
First of all, you should not use server-side services in Tasks implementations, they are only allowed to be used in Configurators.
As it is, your task will fail on remote agents. You should make sure all data you need to execute task is either stored in task configuration or injected into RuntimeTaskDefinition using RuntimeTaskDataProvider class.
Answering your question:
public void populateContextForEdit(@NotNull final Map<String, Object> context, @NotNull final TaskDefinition taskDefinition) { PlanKey parentPlanKey = TaskContextHelper.getPlan(context).getPlanKey(); deploymentProjectService.getDeploymentProjectsRelatedToPlan(parentPlanKey) //.... }
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.