2010-10-31 63 views
0

當我嘗試創建一個新的OpportunityLineItemSchedule我遇到下面的錯誤..錯誤,同時創造了新的「OpportunityLineItemSchedule」使用SFDC合作伙伴API

錯誤代碼:INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY

錯誤消息:足夠的訪問權限交叉引用編號

附件是代碼片段。任何幫助將非常有用。

SObject[] rs = new SObject[1]; 
MessageElement[] specificRS = new MessageElement[6]; 
specificRS[0] = new MessageElement(new QName("OpportunityLineItemId"),"00k7000000DFLqfAAH"); 
specificRS[1] = new MessageElement(new QName("Description"),"Rev Schedule Descr"); 
specificRS[2] = new MessageElement(new QName("Type"),"Quantity"); 
specificRS[3] = new MessageElement(new QName("Quantity"),(double)2); 
specificRS[4] = new MessageElement(new QName("Revenue"),(double)400000.00); 
specificRS[5] = new MessageElement(new QName("ScheduleDate"),"2010-10-30"); 

rs[0] = new SObject(); 
rs[0].setType("OpportunityLineItemSchedule"); 
rs[0].set_any(specificRS); 

SaveResult[] sr = null; 
try { 
    sr = binding.create(rs); 
} catch (Exception ex) { 
    System.out.println("An unexpected error has occurred." + ex.getMessage()); 
    ex.printStackTrace(); 
    return; 
} 

回答

0

以下工作..

MessageElement[] specificRS2 = new MessageElement[5]; 
specificRS2[0] = new MessageElement(new QName("OpportunityLineItemId"),"00k7000000DFcOG"); 
// PricebookEntryId can be found by joining PricebookEntry and Pricebook2 tables (on Product2Id and 
specificRS2[1] = new MessageElement(new QName("Description"),"Rev Schedule Descr2"); 
specificRS2[2] = new MessageElement(new QName("ScheduleDate"),"2010-10-31"); 
//specificRS[3] = new MessageElement(new QName("Quantity"),(double)2); 
specificRS2[3] = new MessageElement(new QName("Revenue"),(double)10.00); 
//specificRS[4] = new MessageElement(new QName("Type"),"Quantity"); // and/or "Revenue" 
specificRS2[4] = new MessageElement(new QName("Type"),"Revenue"); // and/or "Quantity" 

rs[1] = new SObject(); 
rs[1].setType("OpportunityLineItemSchedule"); 
rs[1].set_any(specificRS2); 

SaveResult[] sr = null; 
try { 
    sr = binding.create(rs); 
} catch (Exception ex) { 
    System.out.println("An unexpected error has occurred." + ex.getMessage()); 
    ex.printStackTrace(); 
    return; 
} 
0

這通常是當代碼試圖使用一個ID的對象不存在,或者該用戶沒有訪問錯誤。我認爲這兩個片段唯一的區別是OpportunityLineItem ID?檢查運行代碼的用戶是否可以使用該ID訪問該項目。

0

看一看在Allowed Type Field ValuesAllowed Quantity and Revenue Field Values文檔OpportunityLineItemSchedule。

一個OpportunityLineItemSchedule允許的類型值取決於產品級的時間表喜好和訂單項是否有任何現有計劃

您可能需要檢查是否有現有OpportunityLineItemSchedule記錄。

允許的數量和收入字段值取決於類型字段

你只設置數量或收入領域,而不是兩個值。