It's all about the answers!

Ask a question

Is it possible to check if the owner belongs to a project area member in a Java script?


Musashi Tsujiuchi (513) | asked Sep 15, 6:19 a.m.

 Is it possible to check if the owner belongs to the project area with a Java script using a validator in Work Item Customization?


Currently, my project area has a number of dependency attributes set in the owner attribute and a calculated value script set.
By default, when I set "Filed Against", it should warn me whether the owner belongs to the area or not.
However, In my project area, there are more than 100 people belonging to the area, and this does not work.
Also, it is impossible to delete the Calculated Value script because it is so important to the work item.

So I want to use a validator-based Java script to check whether the owner belongs to the project area or not.

If anyone knows if this is possible, please help.
If you can provide a sample, it would help tremendously!

<Rf.>
Why does the warning 'Owner does not belong to Team Area' appear for some users (Member of Project area ) but not others ( Members of same Project area) in a workitem whose filed-against "category = unassigned" is inherited from the project area?
How does "Contributor" field type work?
How does the user lookup for Contributor type attributes populate the list?
Attribute customization condition for precondition
Work Items attribute customization

Accepted answer


permanent link
Ralph Schoon (59.4k23642) | answered Sep 15, 9:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Sep 15, 9:53 a.m.

 For all I know, the JavaScript attribute customization API does not provide such capabilities. There is a bunch of hidden API that might be accessible if the script runs in a browser, but all that stuff is not supported. The supported API is documented and it does not provide any access to the project area process and the like.


If you want do do things like that you would have to use the Java API, likely implement an advisor/pre-condition using the server SDK which needs to be deployed on the server. 

Musashi Tsujiuchi selected this answer as the correct answer

Comments
Musashi Tsujiuchi commented Sep 17, 1:15 a.m.
Hi Ralph, thanks for your comment.
Your comments always help me a lot!

>the JavaScript attribute customization API does not provide such capabilities.

Thank you for your valuable information.
This is unfortunate information, but it is very helpful.

>If you want do things like that you would have to use the Java API, likely implement an advisor/pre-condition using the server SDK which needs to be deployed on the server. the server SDK which needs to be deployed on the server. 

After all, I understood that it will need to be handled on the server side.
With reference to your comment and also the blog, I will consider it.


Thanks once again! 


Ralph Schoon commented Sep 17, 2:19 a.m. | edited Sep 17, 2:20 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Hi,


I do not know if the required APIs are accessible using Java based attribute customization (the link you refer to above). You will have to explore if you can get to the required API. There is some likelihood that this is possible, but not 100%.

I would likely create an advisor, I am absolutely sure that you can implement an advisor that prevents save if the owner is not member of the process area the work item is filed against. See https://rsjazz.wordpress.com/?s=work+item+advisor&submit=Search for how advisors/pre-conditions work.  


Musashi Tsujiuchi commented Sep 17, 5:14 a.m.
Thanks for the additional comments.

It's very helpful.

I'll look into the advisor implementation if users are willing to accept the limitation on saving work items. 


Ralph Schoon commented Sep 17, 6:21 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Last word 8) 


Developing an advisor is complex if you do not have experience. Even the Java Attribute customization is complex. Both need to be deployed in the server and if Eclipse client are used to edit work items, the attribute customization needs to be deployed there. 

If you can live with the warning and there are no consequences, it would be way cheaper to ignore it. 

Just a thought. 

Your answer


Register or to post your answer.