Post

1 follower Follow
0
Avatar

Referencing from Task to Project Level

Hi

I currently use the default "Risks Rate" field at Project level and I want to create a custom Task/WorkItem field that sets itself to whatever it's parent project's Risks Rate is at.

So for example if my Project "A" Has a risk level of 3, I want all the tasks and milestones to have a risk level of 3 as well.

I've tried creating a custom field that has the same value as it's parent using a formula. But for some reason a Task/Workitem field can't access any parent field and only fields at it's own level. This is not very useful.

I also tried creating a workflow rule that would take whatever is in the project Risks Rate field and put it in the Task Risks Rate field, but it only triggers when I edit the actual Task Risks Rate field, which also it not very useful.

I'd prefer not to use a scheduled Workflow rule, as I would like it if the Task Risks Rate field was instantly updated as soon as the project Risks Rate field was edited.

Thanks in advance.
/Leo

Import from old forum Answered

Please sign in to leave a comment.

3 comments

0
Avatar

Hi Leo, 

You are correct, you can only access fields of the current object in custom fields, unless you use a relations summary. 

To accomplish what you are looking for, create a custom field on the work item level called Risk Rate, or whatever.  This can either be a numeric field or a pick list that has the same values as the Risks Rate standard field. 

In this example, i created the Risk Rate custom field as a numeric field.  I then checked off the "formula" check box under the "field type" section and chose "Relations Summary" from the drop down. 

In the "Set Formula" section, I chose "Custom" from the summary type drop down and then selected the  "Impacted and Parents" relation. 

Now in the formula entry box, i entered the following:

if(Targetobject.entitytype='project',Tonumber(tostring((TargetObject.RisksRate))), TargetObject.C_RiskRate)

basically, what this does is checks if the TargetObject is of type project, if yes, then it takes the value of that field and converts it to a number and enters it in the Risk Rate custom field.  If the targetobject is not of type project (meaning a task is under a milestone or a parent task), then that object's Risk Rate custom field value is generated from it's direct parent (which in turn got it's value from the parent project). 

Hope this is well explained, if you have any questions please let me know. 

Thanks!

Import from old forum 0 votes
Comment actions Permalink
0
Avatar

I should also mention, that relation summary fields require a hard refresh to calculate (or some other sort of high level recalculation) so you will only see changes on the tasks after you hit F5.  Just an FYI so you don't think it's not working initially. 

Import from old forum 0 votes
Comment actions Permalink
0
Avatar

Thanks a lot! That worked!

Apparently there is no Relations Summary when you use Pick Field, which was what I was using.
But using Numeric it works, I should have tried Numeric myself.

Very clever piece of code as well, thank you.

While I have your attention, I have another similar problem.

I also want to have a Project Field that indicates which Milestone is the active one.

So if Milestone A, B and C are complete, and Milestone D is at 55%, D is the active one and I want a custom Project level field to indicate that, preferrable using text.

Is this possible using the same method but reversed?

Import from old forum 0 votes
Comment actions Permalink