As you could imagine, this could quickly become confusing to users as to which task belongs to which parent project when viewing multiple tasks and projects at one-time. And what if you had more than just one layer of project and sub-project. In TaskRay you can have up to 5 levels of hierarchy. You likely would want the top-level (or master) project to display on the task card of each sub-project layer.
So how can we easily identify which tasks are related to which top-level/master project?
Below is a solution that should allow you to easily display the master project name as a Task Card Label on the front of any task that is part of a sub-project, even if your hierarchy is more than two layers deep.
To achieve this we'll create a formula field on the TaskRay Task object:
- In Setup, navigate to Create | Objects | TaskRay Task and click New next to the Custom Fields section.
- Choose Formula for data type and output will be Text. You can name this field "Master Project".
- Add in the formula. Feel free to copy and paste the below.
IF( ISNULL(TASKRAY__Project__r.TASKRAY__Project_Parent__r.TASKRAY__Project_Parent__r.TASKRAY__Project_Parent__r.Name), TASKRAY__Project__r.TASKRAY__Project_Parent__r.TASKRAY__Project_Parent__r.Name ,
IF( TASKRAY__Project__r.TASKRAY__Project_Parent__r.TASKRAY__Project_Parent__r.TASKRAY__Project_Parent__r.Name <> NULL, TASKRAY__Project__r.TASKRAY__Project_Parent__r.TASKRAY__Project_Parent__r.TASKRAY__Project_Parent__r.Name ,
IF( ISNULL(TASKRAY__Project__r.TASKRAY__Project_Parent__r.TASKRAY__Project_Parent__r.Name), TASKRAY__Project__r.TASKRAY__Project_Parent__r.Name,
IF( TASKRAY__Project__r.TASKRAY__Project_Parent__r.TASKRAY__Project_Parent__r.Name <> NULL, TASKRAY__Project__r.TASKRAY__Project_Parent__r.TASKRAY__Project_Parent__r.Name ,
IF( ISNULL(TASKRAY__Project__r.TASKRAY__Project_Parent__r.Name), TASKRAY__Project__r.Name,
IF( TASKRAY__Project__r.TASKRAY__Project_Parent__r.Name <> NULL, TASKRAY__Project__r.TASKRAY__Project_Parent__r.Name , TASKRAY__Project__r.Name ))))))
This formula is long since it goes a number of layers deep. This means that you can have many sub, sub, sub-projects and the tasks will still reference the name of its master project. In general this formula is saying if the great grandfather project name doesn't exist then populate the value to be the grandfather project, then if the grandfather project doesn't exist populate with the father's name and so on.
If you need to go even deeper you can create additional IF statement rows to this formula.
Once we've created and saved this field we'll need to add it to our Task Card Label field set.
To do this:
- In Setup, navigate to Create | Objects | TaskRay Task and scroll to the Field Set section.
- Click Edit next to the Task Card Label field set.
- Drag & drop the Master Project field from the top grid into the field set below.
- Be sure to hit Save at the top.
Now when we go back into TaskRay if we have any tasks that are in sub projects or sub, sub projects then the label on the front should be the name of it's master project.