-
JS先要在web resouce中注册 再在表单上注册事件。
-
merge 时,通过来 下面的代码 获得的第二个记录的上的值。
Entity subordinateId = (Entity)context.InputParameters["SubordinateId"]; Entity duplicateEntity = service.Retrieve("account", subordinateId.Id, new ColumnSet(true));
-
statecode 0 可用 1不可用。
-
两个选项的结果值 为true or false。
-
JS中给 lookup字段赋值是 使用下列的代码作为参考。
var array = []; array[0] = {}; array[0].id = ents[0]["accountid"]; array[0].name = ents[0]["accountid@OData.Community.Display.V1.FormattedValue"]; array[0].entityType = "account"; formcontext.getAttribute("new_accountid").setValue(array);
-
当要对js某个字段进行清空时,使用如下示例代码
formcontext.getAttribute("new_accountid").setValue(null);//lookup 字段 formcontext.getAttribute("new_beforezpoint").setValue(null);//decimal 字段
-
锁定表单上所有字段 示例代码
var cs = formcontext.ui.controls.get();//获取所有字段 for (var i in cs) {//对字段进行遍历 var c = cs[i]; if (c.getName() != "" && c.getName() != null) { if (!c.getDisabled()) { c.setDisabled(true); //禁用 } } }
-
当JS的function中使用execontext参数时,代码示例
function lockAllField(execontext) { debugger; var formcontext = execontext.getFormContext(); }
-
注册在表单上时记得✔选
-
JS中调用Web API查询数据示例代码
Xrm.WebApi.retrieveMultipleRecords("account", "?$select=accountid,new_customerid,new_usablepoint&$filter=new_customerid eq '" + bpid + "'and new_pim eq false and statecode eq 0").then(function (success) { var ents = success.entities; //TODO }, function (error) { //TODO });
-
按钮触发 改变字段的值 保存并退出 示例代码
function commitRibbonClick2() { debugger; Xrm.Page.getAttribute("new_status").setValue(1);//设置值and todo Xrm.Page.data.entity.save("saveandclose");//保存并关闭页面 }
-
按钮的显隐控制 工具配置方法链接
function setVisible() { debugger; var status = Xrm.Page.getAttribute("new_status").getValue(); return status==0;//true 为显示 false 为隐藏 }
Dynamics365 JS
最新推荐文章于 2024-10-25 16:35:06 发布