data transfer Archives - Microsoft Dynamics 365 Blog http://microsoftdynamics.in/category/data-transfer/ Microsoft Dynamics CRM . Microsoft Power Platform Wed, 19 Mar 2014 10:41: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 data transfer Archives - Microsoft Dynamics 365 Blog http://microsoftdynamics.in/category/data-transfer/ 32 32 176351444 Copy Field Value from One Entity To Another using Plugin in mscrm 2011 2013 http://microsoftdynamics.in/2014/03/19/copy-field-value-from-one-entity-to-another-using-plugin-in-mscrm-2011-2013/ Wed, 19 Mar 2014 10:41:00 +0000 http://microsoftdynamics.in/2014/03/19/copy-field-value-from-one-entity-to-another-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 System.ServiceModel;using Microsoft.Xrm.Client;using Microsoft.Xrm.Portal;using Microsoft.Xrm.Sdk;using Microsoft.Xrm.Sdk.Query;using Microsoft.Xrm.Sdk.Messages; namespace plugin1{    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_teston test = (new_teston)service.Retrieve(context.PrimaryEntityName, context.PrimaryEntityId, new ColumnSet(true));                     //QueryExpression querry = new QueryExpression(new_testto.EntityLogicalName);            //querry.ColumnSet =...

The post Copy Field Value from One Entity To Another 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 System.ServiceModel;
using Microsoft.Xrm.Client;
using Microsoft.Xrm.Portal;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Messages;

namespace plugin1
{
    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_teston test = (new_teston)service.Retrieve(context.PrimaryEntityName, context.PrimaryEntityId, new ColumnSet(true));
        
            //QueryExpression querry = new QueryExpression(new_testto.EntityLogicalName);
            //querry.ColumnSet = new ColumnSet(true);
            //EntityCollection test1 = service.RetrieveMultiple(querry);
         
            //int count = test1.Entities.Count;

            //new_testto test11 = new new_testto();

            //for (int i = 0; i <= count; i++)
        
            new_testto tes = new new_testto();
            tes.new_name = “test”;
            tes.new_singlelineto = test.new_singleline;
         
            service.Create(tes);

        }
    }
}

SOURCE : JUST2CODE.COM

The post Copy Field Value from One Entity To Another using Plugin in mscrm 2011 2013 appeared first on Microsoft Dynamics 365 Blog.

]]>
2831