js怎么给各中类型字段赋值的
2个回答
2017-01-09 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
ButtonClick: function (EntityName) {
var testEntity = {};
//主属性,名称字段,只能是单行文本
testEntity.new_name = "通过代码新增的记录";
//为单行文本字段赋值
testEntity.new_SingleLine = "This account was created by the JavaScriptRESTDataOperations sample.";
//为两个选项字段赋值,只能赋值为true或者false
testEntity.new_TwoOptionSet = true;
//为选项集字段赋值,为整数,是选项集的存储值,不是显示值
testEntity.new_OptionSet = { Value: 100000001 };
//为货币字段赋值
testEntity.new_Currency = { Value: "20000.1" };
//为浮点数字段赋值,小数即可
testEntity.new_Float = 10.2;
//为十进制字段赋值,特别注意要用引号引用起来
testEntity.new_Decimal = "104.1";
//为整数字段赋值
testEntity.new_Integer = 200;
//为日期和时间字段赋值
testEntity.new_Datetime = new Date();
//为多行文本字段赋值
testEntity.new_MultiLine = "多行文本字段的值多行文本字段的值多行文本字段的值多行文本字段的值----多行文本字段的值";
//为查找字段赋值
testEntity.new_Lookup = { Id: "F3A0BB75-F3AD-E311-80B4-00155D016705", LogicalName: "account", Name: "随便什么值" };
SDK.REST.createRecord(
testEntity,
"new_Test2013",
function (TestEntity) {
Xrm.Utility.alertDialog("新增记录成功,记录id是" + TestEntity.new_Test2013Id + "按确定按钮后将打开新增的记录",
function () {
Xrm.Utility.openEntityForm(EntityName, TestEntity.new_Test2013Id);
});
},
function errorHandler(error) {
alert('Error message:' + error.message);
}
);
}
var testEntity = {};
//主属性,名称字段,只能是单行文本
testEntity.new_name = "通过代码新增的记录";
//为单行文本字段赋值
testEntity.new_SingleLine = "This account was created by the JavaScriptRESTDataOperations sample.";
//为两个选项字段赋值,只能赋值为true或者false
testEntity.new_TwoOptionSet = true;
//为选项集字段赋值,为整数,是选项集的存储值,不是显示值
testEntity.new_OptionSet = { Value: 100000001 };
//为货币字段赋值
testEntity.new_Currency = { Value: "20000.1" };
//为浮点数字段赋值,小数即可
testEntity.new_Float = 10.2;
//为十进制字段赋值,特别注意要用引号引用起来
testEntity.new_Decimal = "104.1";
//为整数字段赋值
testEntity.new_Integer = 200;
//为日期和时间字段赋值
testEntity.new_Datetime = new Date();
//为多行文本字段赋值
testEntity.new_MultiLine = "多行文本字段的值多行文本字段的值多行文本字段的值多行文本字段的值----多行文本字段的值";
//为查找字段赋值
testEntity.new_Lookup = { Id: "F3A0BB75-F3AD-E311-80B4-00155D016705", LogicalName: "account", Name: "随便什么值" };
SDK.REST.createRecord(
testEntity,
"new_Test2013",
function (TestEntity) {
Xrm.Utility.alertDialog("新增记录成功,记录id是" + TestEntity.new_Test2013Id + "按确定按钮后将打开新增的记录",
function () {
Xrm.Utility.openEntityForm(EntityName, TestEntity.new_Test2013Id);
});
},
function errorHandler(error) {
alert('Error message:' + error.message);
}
);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |