Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Change an attribute input field value automatically by event

I need to reset an attribute input field automatically by changing other input field (value set picker).

Is it possible using dojoattachevent onchange?

How can I do that?

Thanks in Advance!

0 votes



2 answers

Permanent link
I would rather look into https://jazz.net/wiki/bin/view/Main/AttributeCustomization and https://jazz.net/library/article/537/ and try out if you can do that using the providers or Java script.
If so it would work in the Web UI as well as in the Eclipse UI.

1 vote

Comments

I´ve readed the articles, but still looking for a way to clean the fields dinamically by changing other input field.


Permanent link
Liney, I have thought about it some more and I see no real option to do that using scripts. Sorry for misleading you. As far as I can tell, there are only the following options to change an attribute value using scripts:

  • Default value provider
  • Calculated value provider.

Default value provider only sets the first time.

You could potentially use a calculated value provider to clear an attribute. Unfortunately I see no way how to distinguish the newly entered value from the old value that got cleared away. As long as the other attribute values are telling to "clear" the value it gets cleared, no matter what you enter. This would not be an issue if you could put a "valid" value on the new attribute value, because that could override the clearing. You could potentially enhance the code below.

I don't find this very easy and I would rather use a precondition to do this. See the RTC Extensions Workshop https://jazz.net/library/article/1000 (follow up action) and examples such as https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ or others you can find in the internet.

Maybe I am missing something here. If others have better solutions, I would be happy to see them.

dojo.provide("com.ibm.js.providers.script.ClearOnValueCalculated");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
    var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;

    dojo.declare("com.ibm.js.providers.script.ClearOnValueCalculated", null, {

        getValue : function(attributeId, workItem, configuration) {
            console.log("ClearOnValueCalculated - Start");

            try {
                var attributeValue ="";
                var otherAttributeLabel = "";
               
                console.log("getValue");
                attributeValue = workItem.getValue(attributeId);
                console.log("getLabel");
                otherAttributeLabel = workItem.getLabel(WorkItemAttributes.SEVERITY);
                console.log("Severity " + otherAttributeLabel);
                if (otherAttributeLabel == "Blocker") {
                    console.log("Clear");
                    return "";
                }
                console.log("Old");
                return attributeValue;
            } catch (e) {
                console.log("Exception:" + e.name + " message " + e.name +" " + e.toString());
            }
            return"";
        }
    });
})();

1 vote

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019

Question asked: Oct 09 '12, 7:05 p.m.

Question was seen: 5,369 times

Last updated: Oct 16 '12, 6:58 a.m.

Confirmation Cancel Confirm