JavaScript:
function OnLoadForm()
{
var formType = Xrm.Page.ui.getFormType();
if(formType == 1){ //formType 1 = Create Form
setLookUp_Country();
}
}
function setLookUp_Country()
{
var country = Xrm.Page.getAttribute("countryid");
var value = new Array();
value[0] = new Object();
value[0].id = "B842D214-3A33-E411-9096-00155D01017A"; // Guid Of That Look Up
value[0].name = "JP"; // Name Of That Look Up
value[0].entityType = "country"; // Entity Name Of That Look Up
Xrm.Page.getAttribute("countryid").setValue(value);
}

沒有留言:
張貼留言