It's all about the answers!

Ask a question

How to copy owned by to another custom attribute


Lucas Dias (11) | asked Aug 16 '18, 9:47 a.m.

Hi!

I'm writing a script part by part to copy who's the owned by to another custom attribute. The goal is to show who was the first owner of the workitem.

So, I'm writing the script my issue is that I'm receiving a error message saying that my var is null and I don't understand why.

dojo.provide("com.example.1stOwned");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
    dojo.declare("com.example.1stOwned", null, {

    getValue: function(attribute, workItem, configuration) {

        try {
            var hold = workItem.getValue("com.ibm.team.workitem.attribute.owner");

            return hold.toString();
        }
        catch(err) {
            var txt;
            txt="There was an error on this page.\n\n";
            txt+="Error description: " + err.message + "\n\n";
            txt+="Click OK to continue.\n\n";
            alert(txt);
        }

    }

    });
})();


This is the error that I'm receiving:

There was an error on this page.

Error description: workItem.getValue(...) is null

Click OK to continue.

Can anybody help me with this error?

One answer



permanent link
Ralph Schoon (54.7k23641) | answered Aug 16 '18, 10:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

"com.ibm.team.workitem.attribute.owner" is an incorrect ID. The Eclipse client shows a wrong external ID that JavaScript does not use.
See the definitions in https://jazz.net/wiki/bin/view/Main/AttributeCustomization or look up the ID string in the Web Admin UI.


Comments
Lucas Dias commented Aug 16 '18, 1:42 p.m. | edited Aug 16 '18, 4:00 p.m.

Now, I'm receiving this error message:

There was an error on this page.

Error description: WorkItemAttributes is not defined

Click OK to continue.

Where do i get to Web Admin UI?


Ralph Schoon commented Aug 16 '18, 4:03 p.m. | edited Aug 16 '18, 4:05 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

com.ibm.team.workitem.api.common.WorkItemAttributes;

    
shows up and how.

Where do i get to Web Admin UI?
If you don't know that, you should probably not do this.Talk to one of your process admins. Or open it using the Open Web UI on the project area in the Eclipse client on the project.

See https://jazz.net/library/article/1093 the RTC version lab 5 for more information about JavaScript Attribute customization.

Your answer


Register or to post your answer.