1
我從crm.dynamics.com/XRMServices/2011/Discovery.svc?wsdl和crm.dynamics.com/XRMServices/2011/Organization.svc生成所有必需的java類?wsdl模式。通過SOAP/Java在MS Dynamics CRM 2011中創建產品
我使用LiveId在CRM中進行身份驗證。
現在我需要在產品目錄中創建產品。代碼如下:
Entity newEntryInfo = new Entity();
AttributeCollection collection = new AttributeCollection();
addAttribute(collection, "name", "Tama Starclassic Performer");
addAttribute(collection, "productnumber", "1");
addAttribute(collection, "price", createMoney("100.0"));
addAttribute(collection, "isstockitem", Boolean.TRUE);
addAttribute(collection, "statuscode", 1);
newEntryInfo.setAttributes(collection);
newEntryInfo.setLogicalName("product");
Guid productGuid = serviceStub.create(newEntryInfo);
private void addAttribute(AttributeCollection collection, String key, Object value) {
KeyValuePairOfstringanyType values = new KeyValuePairOfstringanyType();
values.setKey(key);
values.setValue(value);
collection.addKeyValuePairOfstringanyType(values);
}
執行顯示錯誤「單位計劃ID缺失。」
看起來我需要爲新產品提供「單位組」和「默認單位」。
問題:如何設置這些值?我應該使用相關實體(如何創建它)或屬性(如何創建它)