crm界面很多时候需要获取实体的etc,也就是实体的objecttypecode,怎么获取?下面介绍2中方法。
1: 获取地址的参数:
Xrm.Page.context.getQueryStringParameters().etc
2: 调用 top.RemoteCommand获取:
var name = Xrm.Page.data.entity.getEntityName();var lookupService = new top.RemoteCommand("LookupService", "RetrieveTypeCode");
lookupService.SetParameter("entityName", name);
var result = lookupService.Execute();
var res;
if (result.Success && typeof (result.ReturnValue) == "number") {
res = result.ReturnValue;
}
alert(res);
另外通过sql也可以获取:
select * from entity where name = 'new_competitor_situation'