It's all about the answers!

Ask a question

Condition Script is not being hit for creating required fields.


Timothy Esau (1715) | asked May 07 '15, 6:46 p.m.
edited May 07 '15, 7:05 p.m.
Hello,
     I am trying to set up a Condition script that will set some fields to be required based on the value of the original field.  I was able to get this working on a RTC sever running on my local machine, however I am not able to get condition scripts running at all on the live RTC Server.  Enable Process Attachment Scripts is set to true on both my local RTC server, as well as the live RTC server.  The script set up and operation behaviour were done in eclipse client 4.0.7
edit, seems I can not upload pictures of desktop since I do not have the reputation so I will describe instead
    (set up of the condition script for live server, same setup as the local RTC Server)
    Under attribute Customization, under Conditions, I have a script name Required Attributes for High Severity,
     this script is just the fill in example script and will always return true.
      
(Operation Behavior config)
I have the cell of Everyone and Save Work Item (server) selected, Preconditions and follow-up actions check box selected.  Under preconditions, I have added Required Attributes For Condition.  When this is selected, in the table that says Condition | Attributes, under Condition is Required Attributes for High Severity, and under Attributes is Page/File
 

(showing that the script is indeed located on the site)
A chrome window with the developer console up, under sources I found the Required-Attribute-for-High-Severity.js file and have a breakpoint set on line 18, which is the "return true;" line of the fill in example script.


I performed these same steps for the local RTC server I am running, and the result is that Page/File is always a required field.  Also, the breakpoint on line 18 is hit whenever I make a change to any field.  This is different from the live RTC server, where the page/file field is not required, and the breakpoint is never activated, no matter what field I change.  Any help on this would be great.  Also if you need more information please ask, and I will do my best to respond.  Thank you.







Accepted answer


permanent link
Donald Nong (14.5k614) | answered May 07 '15, 11:46 p.m.
Is it possible that you have preconditions defined for roles other than "Everyone" for the operation "Save Work Item (server)"? Let's say the role "Team Member" has preconditions defined but not the one for your testing purpose, and you log on (to the live RTC server) as "Team Member", then the condition script will not be executed. This is because the "Everyone" role is a "fall back" role (only effective when you have no other roles), not a "catch all" one.
Timothy Esau selected this answer as the correct answer

Comments
Don Yang commented May 08 '15, 12:11 a.m.

Some more info to Donald's answer.
If you configured preconditions in a hierarchy(team > iteration > timeline and so on), the behavior lookup is different, please refer to this article for more details:
https://jazz.net/library/article/292
The clarification of Eeveryone role and how it is effective in the discussion section is helpful as well.


Timothy Esau commented May 08 '15, 10:13 a.m. | edited May 08 '15, 10:14 a.m.

Thank you very much for the quick response.  There are indeed some other preconditions defined for different user roles.  I was assuming that "Everyone" applied the precondition for all users, despite other preconditions set up in their other user roles.  Thank you Don as well for the article you linked as well.  The discussion there is very clear and has corrected my thoughts on how the "Everyone" role works.  Thank both of you so much, as now the condition scripts are working perfect in the live RTC environment.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.