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 getting ETC by Name." + e.description); }}