It's all about the answers!

Ask a question

How to get user loged in RTC for customization


Juan Fernandez (124) | asked Dec 22 '14, 7:51 a.m.
hello, as I can get for this script the user logged this for comparison if the same user owner to determine functionality.
thx.

Comments
sam detweiler commented Dec 22 '14, 9:47 a.m.

please explain a little more.. script?  mean javascript?  value, default, ???

I don't think you can get the current contributor (or set those type fields) with script extensions to field handling in javascript.

Accepted answer


permanent link
Amaury Quintero (901217) | answered May 18 '15, 7:16 a.m.
...

dojo.require("com.ibm.team.repository.web.client.session.Session");
...

Very easy

(function() {
...

var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
var getAuthenticatedContributor = com.ibm.team.repository.web.client.session.getAuthenticatedContributor;

dojo.declare("com.ibm.san.ariadna.process.SampleReadOnlyCondition", null,
{
matches : function(workItem, configuration) {

var loggedInUser = getAuthenticatedContributor().itemId;
var owner = workItem.getValue(WorkItemAttributes.OWNER);

var result = (loggedInUser != owner);

return result;
}

});
})();

Ralph Schoon selected this answer as the correct answer

3 other answers



permanent link
Juan Fernandez (124) | answered Dec 22 '14, 9:53 a.m.
Sam,
I'm using 'Script based condition' and I need to restrict the change of an attribute only if the logged user is the same owner workItem. and I have the 'owner' of Workitem(workItem.getLabel("owner");), but not how to get the user logged to compare and condition. or is there another way to do this?
thx.

Comments
sam detweiler commented Dec 22 '14, 10:01 a.m.

thanks for the additional info.. unfortunately I don't think there is a way to get the current user value in javascript.


permanent link
Juan Fernandez (124) | answered Dec 22 '14, 10:16 a.m.
thanks,
Don't exist any way to condition this ???

permanent link
Juan Fernandez (124) | answered Dec 22 '14, 10:31 a.m.
:)
Thanks Sam.

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.