Post

2 followers Follow
0
Avatar

Custom Panel query all tasks

In this article:

https://success.planview.com/Planview_AdaptiveWork/Configurations/Custom_Panels

 

It shows how to query Clarizen data through a custom panel in the Script and Data (JSON Format) inputs.

 

My question is - on that page it shows this as an example:

{
  "project": {{JsonObject(CurrentObject(),"Name,StartDate,CreatedBy,Manager.Name")},
  "customers": {{JsonObjects("$Customers","Name","TargetObject.AccountStatus='Lead'")}
}

 

I have been playing with it and doing things like:

{
  
  "milestones": {{JsonObjects("$Children","Name,StartDate,ExternalID,DueDate,EntityType,State.Name", "TargetObject.EntityType = 'Milestone' ")},
  "impact_tasks": {{JsonObjects("$Children","Name,StartDate,ExternalID,DueDate,EntityType,State.Name", "TargetObject.EntityType = 'Task' ")}
 
}

 

Which will give me the milestones to the project and the tasks which are directly attached to the project.

 

Is there a way to write from the above:

"impact_tasks": {{JsonObjects("$Children","Name,StartDate,ExternalID,DueDate,EntityType,State.Name", "TargetObject.EntityType = 'Task' ")}

so that it can pull all tasks attached to the milestones and recursively pull all tasks on those?

 

The use case is, I want to get all tasks one can find on the project and milestones and sub tasks on those tasks, then I would filter them down based on some condition.

 

"impact_tasks": {{JsonObjects("$Children","Name,StartDate,ExternalID,DueDate,EntityType,State.Name", "TargetObject.EntityType = 'Task'  && TargetObject.C_somefield = 'Large'")}

 

 

Jared Thompson

Official comment

Avatar

Hi Jared,

One way to do this would be to query all tasks where project is the current project. This is how you can do this:

The variable taskData will contain the array of tasks. Code from screenshot:

const project = API.Context.getData().project;
console.log(project);

API.Objects.query(`SELECT Name FROM Task WHERE Project='${project.id}'`, taskData => {
    console.log(taskData);
});

 

{
  "project": {{JsonObject(CurrentObject(),"Name,StartDate,CreatedBy,Manager.Name,ExternalId")}
}

Hope this helps.

Best regards,

Roland

 

Roland Pumputis
Comment actions Permalink

Please sign in to leave a comment.

1 comment