在开发Dynamics CRM的部分场景时咱们会遇到一些须要去锁定用户的操做,因此就须要使用Javascript把用户的弹窗弹出来。具体作法以下url
咱们须要拼接一个弹出选择记录框的urlcode
Url格式:CRM访问地址/_controls/lookup/lookupsingle.aspx?class=null&objecttypes=" 实体的objectcode"&browse=0&ShowNewButton=1&ShowPropButton=1&DefaultType=0ip
其中实体的objectcode能够根据本身的须要进行修改,此处用到用户和团队对于的objectcode分别是8和9,用逗号隔开8,9就能够了。开发
再使用弹窗的方法把url传进去get
var UserSelect= new Mscrm.CrmDialog(Mscrm.CrmUri.create(Url), window, 500, 600);it
UserSelect.setCallbackReference(function (data) { //data为弹出框选择的结果
//在此处添加修改案例全部者的代码。
例:
var UserList= new Array();
UserList[0] = new Object();
UserList[0].id = data.items[0].id;
UserList[0].name = data.items[0].name;
UserList[0].entityType = data.items[0].typename;
Xrm.Page.getAttribute("ownerid").setValue(UserList);
Xrm.Page.data.entity.save();//案例全部者信息修改完成保存案例信息
});
dialogwindow.show();io