2014-01-22 40 views
0

我在事件表單中添加了子網格,它顯示了具有相同事件分類的知識庫文章。創建記錄時設置子網格

當我打開一個現有的事件時,它工作的很好,但它在創建新事件時不起作用。

在子格是「啓用此內容,保存記錄

我希望當記錄相關的這種行爲,但我做一個查詢和設置子格。

因此,我的要求是在創建事件時啓用並能夠設置子網格,然後保存它。

更多的是,當保存記錄失敗,因爲一個插件停止它時,子網格工作正常,當分類改變,而不是被保存的事件。

function Form_OnLoad() { 
    ... 
    if (formType == "1") { ...} 
    else 
    { 
     //Check if there is/are article(s) with the same subject of the case 
     check_articles(); 
    } 



function check_articles() 
{ 
    var KBArtGrid = document.getElementById('grid_kb_articles'); 

if (KBArtGrid == null) { //make sure the grid has loaded 
    setTimeout(function() { check_articles(); }, 500); //if the grid hasn’t loaded run this again when it has 
    return; 
} 

var classificationValue = new Array(); 
classificationValue = Xrm.Page.getAttribute("subjectid").getValue(); 

if(classificationValue != null && classificationValue[0] != null) { 

var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" + 
" <entity name='kbarticle'>" + 
" <attribute name='number' />" + 
" <attribute name='title' />" + 
" <attribute name='statecode' />" + 
" <attribute name='kbarticletemplateid' />" + 
" <order attribute='number' descending='false' />" + 
" <filter type='and'>" + 
"  <condition attribute='subjectidname' operator='like' value='" + '%' +classificationValue[0].name +'%'+ "' />" + 
" </filter>" + 
" </entity>" + 
" </fetch>"; 

KBArtGrid.control.SetParameter("fetchXml", fetchXml); 
KBArtGrid.control.Refresh(); 
+3

問題是「我想在創建新事件時啓用子網格」?答覆是「你無法支持自定義設置」。也許有一種不支持的方式,但請在你的問題中解釋你的要求:) –

+2

你可以使用一個html web資源列出知識庫文章。 – Bvrce

+0

我想將它放在一個子網格中,我沒有看到它的網頁設計。 – Jorge

回答

0

我還沒有嘗試這個,但我認爲你可以通過從兩個實體都有一個自定義字段映射字段來實際鏈接它。

導致失敗的原因是因爲事件的GUID尚未在保存事件之前創建,因此KB文章沒有GUID來建立關係。

您可以在保存之前預先保存事件並將GUID傳遞給KB以進行存儲。或者使用上面提到的映射。有了這個,您可能還需要以KB爲單位存儲引用數據。

相關問題