2014-03-04 32 views
7

我正在使用MS Dynamics CRM 2013,我正面臨下一期:2011年CRM中的 我通過使用下一個jscript禁用了查看和實體選擇:Jscript在查找時禁用視圖選擇器在CRM 2013中不起作用

document.getElementById("lookup_id").setAttribute("disableViewPicker", "1"); 
document.getElementById("lookup_id").setAttribute("defaulttype", "1"); 
document.getElementById("lookup_id").setAttribute("lookuptypenames", "account:1:Account"); 
document.getElementById("lookup_id").setAttribute("lookuptypes", "1"); 

但是,在遷移到Dynamics Crm 2013後,此腳本不再有效。

你能幫我解決這個問題嗎?謝謝!

回答

3

嘗試添加「_i」與屬性Id如
的ContactID是您的查找屬性名稱,那麼你應該通過像

document.getElementById("contactid_i").setAttribute("disableViewPicker", "1"); 
document.getElementById("contactid_i").setAttribute("defaulttype", "1"); 
document.getElementById("contactid_i").setAttribute("lookuptypenames","account:1:Account"); 
document.getElementById("contactid_i").setAttribute("lookuptypes", "1"); 

2011年屬性輸入ID是一樣的屬性名稱CRM,但在CRM 2013屬性輸入id是屬性名稱加「_i」(也許「_i」表示輸入)。
我試圖在2013年完美的屏蔽和多路複用器列表中嘗試此「_i」。希望它有助於您的情況。

https://stackoverflow.com/a/21552357/1915855

+1

這與「_i」做工精細。今天我已經測試它,同時升級js到crm 2013 –

+0

它的工作原理!謝謝,它幫助了我很多! –

-2

最佳做法是使用Xrm.Page對象:

Xrm.Page.ui.controls.get("lookup_id").setDisabled(true); 

加雷斯·塔克有很大JavaScript reference for Dynamics CRM

Dynamics CRM不支持直接使用DOM;安裝更新彙總後,當前的代碼可能會再次中斷。見JavaScript Programming Best Pratices on this MSDN page.

+1

我不認爲你可以實現他們正在嘗試使用支持的方法。該代碼應該是禁用(例如在活動派對中)從賬戶或聯繫人中進行選擇的可能性,並強制用戶選擇,比方說,只接觸聯繫人。 – Draiden

0

您還可以在自定義禁用它, 在形式,編輯查找時

選擇「視圖選擇」 - >關閉

相關問題