關注本人微信和易信公衆號: 微軟動態CRM專家羅勇 ,回覆238或者20161127可方便獲取本文,同時能夠在第一間獲得我發佈的最新的博文信息,follow me!個人網站是 www.luoyong.me 。瀏覽器
static void Main(string[] args) { try { var crmSvc = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CRM365"].ConnectionString); if (crmSvc.IsReady) { //<snippetDumpEditableGridEntityInfo1> RetrieveAllEntitiesRequest request = new RetrieveAllEntitiesRequest() { EntityFilters = EntityFilters.Entity, RetrieveAsIfPublished = true }; // Retrieve the MetaData. RetrieveAllEntitiesResponse response = (RetrieveAllEntitiesResponse)crmSvc.Execute(request); // Create an instance of StreamWriter to write text to a file. // The using statement also closes the StreamWriter. // To view this file, right click the file and choose open with Excel. // Excel will figure out the schema and display the information in columns. String filename = String.Concat("EditableGridEntityInfo.xml"); using (StreamWriter sw = new StreamWriter(filename)) { // Create Xml Writer. XmlTextWriter metadataWriter = new XmlTextWriter(sw); // Start Xml File. metadataWriter.WriteStartDocument(); // Metadata Xml Node. metadataWriter.WriteStartElement("Metadata"); foreach (EntityMetadata currentEntity in response.EntityMetadata) { // Start Entity Node metadataWriter.WriteStartElement("Entity"); bool canBeDisplayedInSitemap = currentEntity.IsCustomizable.Value; if (canBeDisplayedInSitemap) { metadataWriter.WriteElementString("LogicalName", currentEntity.LogicalName); metadataWriter.WriteElementString("DisplayName", currentEntity.DisplayName.UserLocalizedLabel?.Label); metadataWriter.WriteElementString("CanEnableEditableGridWeb", (!(bool)currentEntity.IsChildEntity && ((bool)currentEntity.IsAIRUpdated || (bool)currentEntity.IsCustomEntity)).ToString()); metadataWriter.WriteElementString("CanEnableEditableGridMobile", (currentEntity.IsVisibleInMobileClient.Value || currentEntity.IsVisibleInMobileClient.CanBeChanged).ToString()); } // Write the Entity's Information. //End Entity Node metadataWriter.WriteEndElement(); } // End Metadata Xml Node metadataWriter.WriteEndElement(); metadataWriter.WriteEndDocument(); // Close xml writer. Console.WriteLine("Dumped information in the EditableGridEntityInfo.xml file"); } } else { Console.WriteLine("鏈接CRM出錯:" + crmSvc.LastCrmError); } Console.WriteLine("程序運行完成!"); Console.ReadKey(); } catch (FaultException ex) { Console.WriteLine("程序出現異常:ex.Message=" + ex.Message); Console.ReadKey(); } }
function accountNameOnchangeHandler(execObject) { var entityObject = execObject.getFormContext().data.entity; var nameAttr = entityObject.attributes.getByName('name'); var isNameContainstest = nameAttr.getValue().indexOf('測試') === -1; // nameField will be an Xrm.Page control if invoked from a form OnChange event; // nameField will be a editable grid GridCell object if invoked from editable grid OnChange event. var nameField = nameAttr.controls.getByIndex(0); if (!isNameContainstest) { nameField.setNotification('客戶名稱不能包括測試二字!', 'nameNotification'); } else { nameField.clearNotification('nameNotification'); } }