Posts

Showing posts from March, 2018

Association of records using plugin in MS CRM

using Microsoft.Xrm.Sdk; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xrm.Sdk.Query; using Microsoft.Xrm.Sdk.Messages; namespace Marketing_List {     public class Account_Association:IPlugin     {         public void Execute(IServiceProvider serviceProvider)         {             IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));             IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));             IOrganizationService service = factory.CreateOrganizationService(context.UserId);             if(context.InputParameters["Target"]is Entity && context.InputParameters.Contains("Target"))             {                 Entity product = context.InputParameters["Target"] as Entity;                

Association and Dissociation of records using plugin in MS CRM

using System; using System.Collections; using System.Text; using Microsoft.Xrm.Sdk; using System.Web; using System.Xml; using System.Diagnostics; using Microsoft.Xrm.Sdk.Query; using Microsoft.Xrm.Sdk.Client; using Microsoft.Xrm.Sdk.Messages; namespace Termination { ///// In Enquiry entity we are having the subgrid of CarrirerSupplierRateRequest and RateRequestAdditional /////1. Registering the Plugin on Create and Update CarrirerSupplierRateRequest entity /////2. CarrirerSupplierRateRequest is having the lookup are aki_enquirynumber and aki_raterequestadditionals /////3. Enquiry and RateRequestAdditional entities are having the N:N relationship /////4. creating and updating the CarrirerSupplierRateRequest entity with aki_raterequestadditionals lookup field we are updating the sub grid(raterequestadditionals) in Enquiry entity     public class AssociateAndDissociateRRA : IPlugin     {         public void Execute(IServiceProvider serviceProvider)         {