How to save workitem through DOJO programming language?
2 answers
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
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