如何使用 SDK2 创建新对象(例如缺陷)?
这一定是显而易见的,我只是错过了它——我已经使用 SDK2 一段时间了,但这个问题已经严重出现了。它是 SDK 层次结构的数据部分下的东西吗?
最佳答案
您可以通过对象模型的实例来执行此操作,类似于以下内容:
Rally.data.ModelFactory.getModel({
type: "Defect",
success: function (defectModel) {
var newDefect = Ext.create(defectModel, {
Name : "My New Defect from SDK2",
Priority : "Normal",
Severity : "Minor Problem",
Description : "Improper display of...",
State : "Submitted"
// Other relevant/required fields
});
newDefect.save({
callback: function(result, operation) {
if(operation.wasSuccessful()) {
//Get the new defect's objectId
var objectId = result.get('ObjectID');
}
}
});
}
});
文档中的以下页面显示了 AppSDK2 的完整创建/读取/更新/删除周期:
https://developer.help.rallydev.com/apps/2.0p5/doc/#!/guide/appsdk_20_data_models
关于rally - 在SDK2中创建对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16349702/