我们写程序常用的就是获取字段的值,对于不同的字段类型,通过getValue() 获取到的值如下,这个表摘自SDK中的 Xrm.Page.data.entity attribute (client-side reference) 章节。

Attribute Type

Return Type

boolean

Boolean

datetime

Date

To get the string version of a date using the Microsoft Dynamics CRM user’s locale preferences, use the format and localeFormat methods. Other methods will format dates using the operating system locale rather than the user’s Microsoft Dynamics CRM locale preferences.

decimal

Number

double

Number

integer

Number

lookup

Array

An array of lookup objects.

Note

Certain lookups allow for multiple records to be associated in a lookup, such as the To: field for an e-mail entity record. Therefore, all lookup data values use an array of lookup objects – even when the lookup attribute does not support more than one record reference to be added.

Each lookup has the following properties:

entityType

String: the name of the entity displayed in the lookup

id

String: The string representation of the GUID value for the record displayed in the lookup.

name

String: The text representing the record to be displayed in in the lookup.

memo

String

money

Number

optionset

Number

string

String

我具体通过下面的代码来演示各种字段获取值得方法:

elseif(Xrm.Page.ui.getFormType()==2){//打开现有记录来修改
Xrm.Page.data.entity.attributes.forEach(
function(attribute, index){
var attrType = attribute.getAttributeType();
switch(attrType)
{
case"boolean":
                           alert("字段类型:两个选项;\n字段逻辑名称:"+ attribute.getName()+":\n字段必输属性:"+ attribute.getRequiredLevel()+";\n提交属性:"+ attribute.getSubmitMode()+";\n值是否修改过:"+ attribute.getIsDirty()+"\n值:"+ attribute.getValue());
break;
case"datetime":
                           alert("字段类型:日期和时间;\n字段逻辑名称:"+ attribute.getName()+":\n字段必输属性:"+ attribute.getRequiredLevel()+";\n提交属性:"+ attribute.getSubmitMode()+";\n值是否修改过:"+ attribute.getIsDirty()+"\n值:"+ attribute.getValue());
break;
case"decimal":
                           alert("字段类型:十进制数;\n字段逻辑名称:"+ attribute.getName()+":\n字段必输属性:"+ attribute.getRequiredLevel()+";\n提交属性:"+ attribute.getSubmitMode()+";\n值是否修改过:"+ attribute.getIsDirty()+"\n值:"+ attribute.getValue());
break;
case"double":
                           alert("字段类型:浮点数;\n字段逻辑名称:"+ attribute.getName()+":\n字段必输属性:"+ attribute.getRequiredLevel()+";\n提交属性:"+ attribute.getSubmitMode()+";\n值是否修改过:"+ attribute.getIsDirty()+"\n值:"+ attribute.getValue());
break;
case"integer":
                           alert("字段类型:整数;\n字段逻辑名称:"+ attribute.getName()+":\n字段必输属性:"+ attribute.getRequiredLevel()+";\n提交属性:"+ attribute.getSubmitMode()+";\n值是否修改过:"+ attribute.getIsDirty()+"\n值:"+ attribute.getValue());
break;
case"lookup":
                           alert("字段类型:查找;\n字段逻辑名称:"+ attribute.getName()+":\n字段必输属性:"+ attribute.getRequiredLevel()+";\n提交属性:"+ attribute.getSubmitMode()+";\n值是否修改过:"+ attribute.getIsDirty()+"\n显示值:"+ attribute.getValue()[0].name +";选择记录ID"+ attribute.getValue()[0].id +"选择记录逻辑名称:"+ attribute.getValue()[0].entityType);
break;
case"memo":
                           alert("字段类型:多行文本;\n字段逻辑名称:"+ attribute.getName()+":\n字段必输属性:"+ attribute.getRequiredLevel()+";\n提交属性:"+ attribute.getSubmitMode()+";\n值是否修改过:"+ attribute.getIsDirty()+"\n值:"+ attribute.getValue());
break;
case"money":
                           alert("字段类型:货币;\n字段逻辑名称:"+ attribute.getName()+":\n字段必输属性:"+ attribute.getRequiredLevel()+";\n提交属性:"+ attribute.getSubmitMode()+";\n值是否修改过:"+ attribute.getIsDirty()+"\n值:"+ attribute.getValue());
break;
case"optionset":
                           alert("字段类型:选项集;\n字段逻辑名称:"+ attribute.getName()+":\n字段必输属性:"+ attribute.getRequiredLevel()+";\n提交属性:"+ attribute.getSubmitMode()+";\n值是否修改过:"+ attribute.getIsDirty()+"\n选择值:"+ attribute.getValue()+"选择文本:"+ attribute.getText());
break;
case"string":
                           alert("字段类型:单行文本;\n字段逻辑名称:"+ attribute.getName()+":\n字段必输属性:"+ attribute.getRequiredLevel()+";\n提交属性:"+ attribute.getSubmitMode()+";\n值是否修改过:"+ attribute.getIsDirty()+"\n值:"+ attribute.getValue());
break;
default:
                           alert("未知");
}
});
}

效果如下,需要注意查找字段获取值得分析。

 


   

 
     

转载于:https://blog.51cto.com/wenzengliu/1788532

CRM 客户端程序开发:获取表单界面上各种字段的值及其他属性相关推荐

  1. 微信小程序之获取表单数据

    前言:微信小程序中很多地方运用到了表单,很多时候我们需要把表单中的内容提取出来返回给后台,这里我随便写了一点 注意点: 1.所有的input  textarea button全部包含在form表单元素 ...

  2. CRM 客户端程序开发:设置实体表单界面字段的值

    为了方便演示,我这里新建一个实体,实体定义如下: 还为它定义了如下的自定义字段,每种可定义的类型都有,基本上都是使用默认设置: 并且修改了它的窗体类型为主要的窗体,使它新建记录的界面如下所示: 我这里 ...

  3. 微信小程序开发之表单验证(WxValidate使用)

    微信小程序的开发框架个人感觉大体上跟VUE是差不多的,但是他的表单组件没有自带的验证功能,因此开发小程序的表单验证时候一般有两种方法,一是自己裸写验证规则,但是需要比较扎实的正则表达式基础,一种是利用 ...

  4. 微信小程序开发——form表单

    WeChat小程序交流(QQ群:769977169) 效果图 代码示例 1.xxx.wxml <form bindsubmit='submitClick' bindreset='resetCli ...

  5. Dynamics CRM 2013 SP1 客户表单界面上联系人subgrid上的添加现有联系人功能缺失

    CRM2013打了SP1的同学会发现一个问题,客户关联联系人的1:N关系,在表单subgrid中添加联系人时,只能新建而无法添加现有联系人,而这个现象在之前的版本中是没有的. 我们通过工具ribbon ...

  6. Dynamics CRM 客户端程序开发:常用工具介绍之Dynamics XRM Tools

    声明:本博客参照以下网址,在此标记以便自己以后查询方便. http://luoyong0201.blog.163.com/blog/static/112930520142782014329/

  7. 获取表单 input框中输入的值

    html: <input type="text" value="请输入..." id="txt"/><button id= ...

  8. python测试开发django-25.表单提交之post注册案例

    前言 一个网站上新用户注册,会写个注册页面,如果用django写个注册页面的流程呢? 本篇以post请求示例,从html页面上输入用户注册信息,提交到后台处理数据,然后传参数据到User数据库表里面 ...

  9. SNF快速开发平台MVC-各种级联绑定方式,演示样例程序(包含表单和表格控件)...

    做了这么多项目,经常会使用到级联.联动的情况. 如:省.市.县.区.一级分类.二级分类.三级分类.仓库.货位. 方式:有表单需要做级联的,还是表格行上需要做级联操作的. 实现:实现方法也有很多种方式. ...

最新文章

  1. CV_8UCV_32FCV_32S
  2. jpgraph中文使用手册之文本和字体控制教程
  3. 德国政府发布新网络安全战略
  4. LeetCode 1161. 最大层内元素和(层序遍历)
  5. 提交表单数据到数据库_普通表单不仅适用于数据库
  6. eclipse中不能找到dubbo.xsd报错”cvc-complex-type.2.4.c“的 两种解决方法
  7. 花呗下调部分年轻用户额度,倡导理性消费,网友:是嫌我穷了吗?
  8. ECS之Component组件
  9. 模板模式与策略模式/template模式与strategy模式/行为型模式
  10. [原创]软件质量管理培训
  11. Java基础0309
  12. Windows XP pro with sp2(x64)VOL版(英文原版)光盘镜像 + 简繁中文语言包 + 有效安装密钥 一些网友都有这样的困惑,Windows XP sp3在安装
  13. 打印九九乘法表算法-java
  14. 安杰文高等计算机与生产技术学校,留学预警:2012年教育部承认的法国大学名单...
  15. 写一个函数,将一个字符串中的元音字母复制到另一字符串,然后输出。
  16. nbuoj.1333.明信片与照片
  17. Bing(必应)搜索,为什么用户越来越多?
  18. Nginx rewrite路由重写
  19. 机器学习基础:最大似然(Maximum Likelihood) 和最大后验估计 (Maximum A Posteriori Estimation)的区别
  20. 视频监控摄像头的互联网化实践思路

热门文章

  1. AI干货系列一:为什么AI预测更智能?
  2. SAP MM 事务代码MI31之思考之续集
  3. SAP MB1B + 313315做二步法货物移动报错-创建交货的数据不完全(客户)-
  4. 免费教材丨第49期:数学基础课程----漫画线性代数、微积分超入门
  5. 为提高能量利用效率,大脑会对感官进行预测
  6. 这个最基本的生命细节才被揭开——25毫秒核孔穿梭
  7. 机器学习是科学还是“炼金术”?
  8. 数量庞大!中国成长型AI企业研究报告
  9. CICC科普栏目丨时间之箭:从熵到大爆炸再到万物理论(一)
  10. 谷歌AI公布新项目:未来你的宠物可能真的会是“机器”狗!