It's all about the answers!

Ask a question

How can we write script based validators and condition scripting in RTC to display warning message for certain attributes when user wont input the value?


rkRash 123 (11219) | asked Oct 16 '17, 4:59 a.m.
edited Oct 16 '17, 5:54 a.m. by Ralph Schoon (63.1k33646)

HI All,

In RTC, Attribute customization section Can we write script based validators for  displaying warning message when user leaves the attributes without filling value in workitem?

Can  anyone share the syntax for throwing  warning message for validators or if it is possible in condition script based value?




One answer



permanent link
Ralph Schoon (63.1k33646) | answered Oct 16 '17, 5:10 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You are mixing several concepts. I would really suggest to read some of the referenced articles
Making attributes required/mandatory is supported in different ways

1. For work item type and state
2. For conditions - only for this you need JavaScript or Java extensions

There is no way to specify an "Error Message" the UI will show a marker at the attribute and saving will fail if there is no value in a required attribute.

Validations can be specified as well. The "Error Message" is basically specified in the configuration of the validation and not in the script - the script basically only returns an error or a warning or OK.

Read:
For a more detailed how to with examples: https://jazz.net/library/article/1093


Comments
rkRash 123 commented Oct 16 '17, 5:28 a.m.

Thanks Ralph,

I am aware of making attributes required / mandatory which simple using
1)1. For work item type and state

But our use case is similar but we are following the way as MAster- Child Process Configurations.

We have Master Project Area
Where there are two child Project area using the Master PA process configuration,
But we want to make the few attributes  mandatory only in one of the Child1 PA  not to other child2 PA  ,

Hence in this case we thought to go with script based validations or can it be achieved with conditions

Where we can give the write the script with condition
If(child PA=child1)

We wanted to display warning message and allow workitem to be saved.As you mention the script can written warning  than my above use case can be achieved ?so is there any syntax related to RTC that we have to use?







Ralph Schoon commented Oct 16 '17, 5:51 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 JavaScript has only access to work item attribute information. You would have to determine the project area based on one of the attributes of the work item and code it into the script. Not a nice solution. I am not sure if I would take that route. You could try to use required attributes preconditions in the child project area. A much cleaner solution, I  think.


Anyway, 
https://jazz.net/library/article/1003#attributecustomization points to the Wiki and the other link I also already sent has examples. Consider reading  them. They both point to the Wiki with some more JavaScript syntax. 

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.