It's all about the answers!

Ask a question

How to save workitem through DOJO programming language?


Vikash Singh (423065) | asked Mar 18 '15, 5:53 a.m.

I have added one check box in Workitem and would like to save the workItem automaticaly without press the save button on the workItem UI.

Please guide me.

2 answers



permanent link
Jonas Studer (207917) | answered Mar 18 '15, 6:17 a.m.
You can do it through OSLC/REST
https://jazz.net/wiki/bin/view/Main/CqOslcV2

Comments
Vikash Singh commented Mar 18 '15, 6:24 a.m.

Can we do it into DOJO script inside calculate value (Attribute customization) ?


permanent link
Jonas Studer (207917) | answered Mar 18 '15, 6:44 a.m.
dojo.require("com.ibm.team.workitem.web.cache.internal.WorkItemProxyFactory");

var newProxy = WorkItemProxyFactory.getWorkItemProxy({createIfNeeded: true});
newProxy.initialize({projectAreaItemId: "paID", type: "com.ibm.team.apt.workItemType.story", newWorkItem: true, includeHistory: false});

//Set attributes
newProxy.object.attributes.summary.content = nSummary;
newProxy.object.attributes.category.id = nCategory;
newProxy.object.attributes.target.id = nTarget;

                   newProxy.storeWorkItem({
                       self: this,
                       operationMsg: "Saving",
                       applyDelta: true,
                       //instigator: this,
                       onSuccess: function(param) {
                           setTimeout(dojo.hitch(this, function() {
                               this.self.viewlet.refresh();
                               //Release cursor
                                        dojo.query(".class", this.self.viewletNode.id).style({
                                         "cursor": "default",
                                     });
                                        dojo.query("body")[0].style.cursor = "default";
                           }), 1000);
                       }
                   });

Maybe this will help you.
Read the article, and you'll get the Idea of the WIProxy

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.