Источник:
http://mscrmblog.net/2013/10/16/crm-...ng-javascript/
==============
So while developing a solution for a customer I had hard-coded the etc codes for each entity not realising that once deployed on the new system the entity/object type codes for each entity may change on the destination system.
Real life saver!
function GetObjectTypeCodeByName(entityName) { try { var lookupService = new RemoteCommand("LookupService", "RetrieveTypeCode"); lookupService.SetParameter("entityName", entityName); var result = lookupService.Execute(); if (result.Success && typeof result.ReturnValue == "number") { return result.ReturnValue; } else { return null; } } catch (e) { alert("Error while retrieving the ETC Code by Entity Name – " + e.description); }}
Источник:
http://mscrmblog.net/2013/10/16/crm-...ng-javascript/