//Lookup項目Details取得
if (Xrm.Page.data.entity.attributes.get("fieldname").getValue() != null) {
var CustomerId = Xrm.Page.data.entity.attributes.get("fieldname").getValue()[0].id;
var CustomerName = Xrm.Page.data.entity.attributes.get("fieldname").getValue()[0].name;
var CustomerType = Xrm.Page.data.entity.attributes.get("feildname ").getValue()[0].entityType;
}
//Lookup項目に値設定
var formContext = executionContextObj.getFormContext();
var loginUserId = Xrm.Utility.getGlobalContext().userSettings.userId;
loginUserId = loginUserId.replace('{', '').replace('}', '');
var loginName = Xrm.Utility.getGlobalContext().userSettings.userName;
var systemUserLookUp = new Array();
systemUserLookUp[0] = new Object();
systemUserLookUp[0].id = loginUserId;
systemUserLookUp[0].name = loginName;
systemUserLookUp[0].entityType = "systemuser";
formContext.getAttribute("new_lookupuser").setValue(systemUserLookUp);
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme