Posts

Showing posts from May, 2017

How to get the entity schema name list registered in your Dynamics CRM Organization using C#.

Use the following code for fetching entity list names in your console application:   public static EntityMetadata[] GetEntities(IOrganizationService organizationService)         {             Dictionary attributesData = new Dictionary ();             RetrieveAllEntitiesRequest metaDataRequest = new RetrieveAllEntitiesRequest();             RetrieveAllEntitiesResponse metaDataResponse = new RetrieveAllEntitiesResponse();             metaDataRequest.EntityFilters = EntityFilters.Entity;             // Execute the request.             metaDataResponse = (RetrieveAllEntitiesResponse)organizationService.Execute(metaDataRequest);             var entities = metaDataResponse.EntityMetadata;             return entities;         }         public static void PrintEntitySchemaNames()         {             OrganizationServiceProxy _orgservice = CreateCrmServiceObjectOnline();             Console.WriteLine("===================================");             #regio

How to update related entity records in Dynamics CRM using javascript

In this blog, I am going to show how we can update a related entity record through JScript in DYnamics CRM either REST or OData way. First of all I'll show update data using REST Query in Method 1 and then using OData query in method 2. function btnUpdateOnClick() {     try {         var selectedRows = Xrm.Page.getControl("SubGridName").getGrid().getSelectedRows();         selectedRows.forEach(function (selectedRow, i) {             var s = selectedRow.getData().getEntity().getEntityReference();             var selectedRowGuid = s.id;             var selectedRowName = s.name;             var selectedRowEntityName = s.entityType;             UpdateAccount(selectedRowGuid, selectedRowName, selectedRowEntityName);         });     }     catch (e) {         ShowCatchMessage("new_accountservice_ribbonscript.js", "btnUpdateInventoryOnClick", "A1", e.message);     } } Method 1: function UpdateAccount(selectedRowGuid, select
go to top image