using plugin in ms crm Archives - Microsoft Dynamics 365 Blog https://microsoftdynamics.in/category/using-plugin-in-ms-crm/ Microsoft Dynamics CRM . Microsoft Power Platform Tue, 01 Sep 2015 12:46:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/cropped-Microsoftdynamics365-blogs.png?fit=32%2C32&ssl=1 using plugin in ms crm Archives - Microsoft Dynamics 365 Blog https://microsoftdynamics.in/category/using-plugin-in-ms-crm/ 32 32 176351444 Get / Retrieve all Fields of an Entity in MSCRM using C# ( RetrieveEntityRequest ) https://microsoftdynamics.in/2015/09/01/get-retrieve-all-fields-of-an-entity-in-mscrm-using-c-retrieveentityrequest/ Tue, 01 Sep 2015 12:46:00 +0000 http://microsoftdynamics.in/2015/09/01/get-retrieve-all-fields-of-an-entity-in-mscrm-using-c-retrieveentityrequest/ Below Code Retrieve all Fields Of an Entity which can be used to perfore sevral execution Like bulk update of fields in an entity . RetrieveEntityRequest aEntity = new RetrieveEntityRequest();             aEntity.LogicalName = entityLogicanName;           //only get published fields / attributes          ...

The post Get / Retrieve all Fields of an Entity in MSCRM using C# ( RetrieveEntityRequest ) appeared first on Microsoft Dynamics 365 Blog.

]]>
Below Code Retrieve all Fields Of an Entity which can be used to perfore sevral execution Like bulk update of fields in an entity .

RetrieveEntityRequest aEntity = new RetrieveEntityRequest();
            aEntity.LogicalName = entityLogicanName;
          //only get published fields / attributes
            aEntity.RetrieveAsIfPublished = true;
            aEntity.EntityFilters = EntityFilters.All ;
            RetrieveEntityResponse resp = (RetrieveEntityResponse)service.Execute(aEntity);
            EntityMetadata getmetadata = resp.EntityMetadata;
            var crmAttributes = getmetadata.Attributes;
            attributes.Items.Clear();
            foreach (var attr in crmAttributes)
            {
                // filter can be used to get only Custom fields / or System fields with change
                if (attr.IsSecured == false && (attr.CanBeSecuredForUpdate == true || attr.CanBeSecuredForRead == true || attr.CanBeSecuredForCreate == true))
                    attributes.Items.Add(attr.LogicalName);
            }

Hope This Helped You Thanks For the Support , If Any query or suggestion , please comment below

SOURCE : JUST2CODE.IN Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

The post Get / Retrieve all Fields of an Entity in MSCRM using C# ( RetrieveEntityRequest ) appeared first on Microsoft Dynamics 365 Blog.

]]>
2793
GET AND SET VALUES FROM ONE ENTITY TO ANOTHER ENTITY USING PLUGIN IN MSCRM 2011 , 2013 https://microsoftdynamics.in/2014/02/14/get-and-set-values-from-one-entity-to-another-entity-using-plugin-in-mscrm-2011-2013/ Fri, 14 Feb 2014 08:07:00 +0000 http://microsoftdynamics.in/2014/02/14/get-and-set-values-from-one-entity-to-another-entity-using-plugin-in-mscrm-2011-2013/ using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Runtime.Serialization;using Microsoft.Xrm.Sdk;using Microsoft.Xrm.Sdk.Query;namespace elite_employee{    public class Class1 : IPlugin    {        public void Execute(IServiceProvider serviceProvider)        {            IPluginExecutionContext context = (IPluginExecutionContext)             serviceProvider.GetService(typeof(IPluginExecutionContext));            IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);            new_bankreconciliation reconcil = (new_bankreconciliation)service.Retrieve(new_bankreconciliation.EntityLogicalName, context.PrimaryEntityId, new ColumnSet(true));            if (reconcil.new_BankAccount != null)            {                Guid bank = reconcil.new_BankAccount.Id;                New_bank bk = (New_bank)service.Retrieve(New_bank.EntityLogicalName, bank,...

The post GET AND SET VALUES FROM ONE ENTITY TO ANOTHER ENTITY USING PLUGIN IN MSCRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;

namespace elite_employee
{
    public class Class1 : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            IPluginExecutionContext context = (IPluginExecutionContext)
             serviceProvider.GetService(typeof(IPluginExecutionContext));
            IOrganizationServiceFactory serviceFactory =
(IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            new_bankreconciliation reconcil = (new_bankreconciliation)service.Retrieve(new_bankreconciliation.EntityLogicalName, context.PrimaryEntityId, new ColumnSet(true));
            if (reconcil.new_BankAccount != null)
            {
                Guid bank = reconcil.new_BankAccount.Id;

                New_bank bk = (New_bank)service.Retrieve(New_bank.EntityLogicalName, bank, new ColumnSet(true));
                reconcil.new_BalanceLastStatement = bk.New_Balance;
                reconcil.new_StatementEndingBalance = bk.new_BalanceLastStatement;
                service.Update(reconcil);
            }
        }
    }
}

SOURCE : JUST2CODE.IN
Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

The post GET AND SET VALUES FROM ONE ENTITY TO ANOTHER ENTITY USING PLUGIN IN MSCRM 2011 , 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
2850