It's all about the answers!

Ask a question

Custom error message for mandatory attributes possible?

Ilona Krammer (159549) | asked May 30 '18, 2:01 a.m.
I have found a description for a "required properties" pre-condition which is not available (anymore?) but nothing else.

Can someone help me out and tell me if it's possible to configure custom error messages for mandatory attributes that were configured with the built-in pre-condition?
Or is the only way to get that done to write an extension (though then I am guessing I won't have that asterisk to indicate that the attribute is mandatory)?

Accepted answer

permanent link
Ralph Schoon (63.3k33646) | answered May 30 '18, 3:49 a.m.
edited May 30 '18, 3:50 a.m.

Hi Illona,

the only option I see is to write your own work item save advisor. You will have to use the built in advisors in addition to your own advisor if you want to have UI support to show which attributes are required (the asterisk) and in that context you will have to live with whatever hover is provided by the built in stuff.

The reason is quite complex and not obvious. I wrote about this in section How Does the RTC Code Work?

What happens is that RTC provides an extension point to prevent saving when attributes are required etc. The extension works if you press the save button. To show the user that something is required or make it read only etc. the UI needs to compute this before the save button is pressed. To allow for that there is a hardcoded relationship built into the UI code working with the configuration of the built in advisors to show the information.

It is impossible to hook up custom advisors here. That is why you can not make any impact on the UI. You can only show specific errors when the user presses the save button.

Ilona Krammer selected this answer as the correct answer

One other answer

permanent link
Luca Martinucci (1.0k396112) | answered May 30 '18, 2:53 a.m.
edited May 30 '18, 2:55 a.m.

 Actually I think that the only way is to write an extension (a custom pre-condition) that checks the values of the mandatory attributes and returns and error when any of them is empty.

You can set the error message in the IAdvisorInfo object. 

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.