Quantcast
Channel: Forum CRM Development
Viewing all articles
Browse latest Browse all 1000

Plugin is not getting trigger on Associate message (for N:N relationship)

$
0
0

Hi All,

I've a requirement to create a plugin on N:N relationship, for that I've created a plugin and registered it on Associate and Disassociate message, but my plugin is not getting trigger when I am adding records to the N:N relationship.

I'd register it on post stage as synchronous.

below is the plugin code which I am using.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xrm.Sdk;
using System;
using System.Data;
using System.Globalization;
using System.ServiceModel;

namespace TestPlugin
{
    public class TestPlugin :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);
            // IOrganizationService service = serviceFactory.CreateOrganizationService(null);
            throw new Exception("Exception on Associate/Disassociate ");
        }
    }
}

Can anybody tell me why this is not getting trigger? any help much appreciated.

Thanks!!! 


Viewing all articles
Browse latest Browse all 1000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>