Post

2 followers Follow
0
Avatar

Sub-case to IsChanged (only if IsChanged is some contexts)

I have a validation rule that prevents updates on work items if the work item or parents have Phase="Archived".
You are allowed to change the parent of an Archived work items.

This is all working well:

CurrentUser()<>'BleauSystem' &&
(Not IsTriggeredBy('API') || Not IsTriggeredBy('Counters')) &&
Not IsChanged($Parent) &&
(
(If(($Phase='Archived'),1,0) +
If((Not(IsNull($Parent)) && $Parent.Phase='Archived'),1,0) +
If((Not(IsNull($Parent.Parent)) && $Parent.Parent.Phase='Archived'),1,0) +
If((Not(IsNull($Project)) && $Project.Phase='Archived'),1,0)
)

0) &&

Not IsChanged($Phase)

However, I'd like "Not IsChanged($Parent)" part to take into account that you should not be allowed to change the parent so CurrentObject() is below and Archived work item, that is, you should be allowed to move Archived work items around but not make them child under an archived work item, so something like this:
(Not IsChanged($Parent) unless ($Parent.Phase='Archived'))
Anyone with hints?

Peter Fjelsten Answered

Please sign in to leave a comment.

3 comments

0
Avatar

HI Peter,

I would suggest to create this validation rule on the parent link creation and not on the Work Item. Your validation should be: $Parent.Phase='Archived'.

Please let me know if that worked.

Regards,
Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

Hi Tamir

Thanks. So you don't think it's possible to have all in one validation rule?

Peter Fjelsten 0 votes
Comment actions Permalink
0
Avatar

Hi Peter,

I don't think it is possible to have it under one rule.

Tamir

Tamir Avital 0 votes
Comment actions Permalink