0
我正在Microsoft Dynamics CRM Online中定制表单,并需要将字段值设置为当前用户的ID。我有正确拉取SystemUserID的代码,但我很难将值存入表单字段。如何在JavaScript中将User字段设置为SystemUserId?
//Lots of XML/SOAP stuff to pull the user information
var systemUserIdNode = entityNode.selectSingleNode("q1:systemuserid");
crmForm.all.FieldForUserID.DataValue = systemUserIdNode; //Fails silently
[更新] 一些挖后,我已经基于SDK的样本来更新我的代码。它现在看起来像这样:
var userIdValue = new Array();
userIdValue [0] = new LookupControlItem(systemUserIdNode, 8, fullNameNode);
crmForm.all.new_useridfield.DataValue = userIdValue ;
但是,这会导致在最后一行错误 - “对象不支持此属性或方法”。所以我仍然难住(更多,因为样本不在SDK中)。