CRM2013 - I have a custom entity new_originatingaccounts. On this entity I have two plugins, one for Create and one for Update. The entity has a two Option field called new_active. if this is set to NO then a workflow sets the record as deactivated. I am trying to fire a new plugin when the record is deactivated. After many hours of frustration, I have tried something simple just to get it working, but still nothing. I have been looking at lots of threads, so please be gentle if this looks completely wrong
Code
Imports System Imports System.Collections.Generic Imports System.Linq Imports System.Text Imports Microsoft.Xrm.Sdk Imports System.ServiceModel Imports Microsoft.SqlServer Imports System.IO Imports CRM2013_Plugins.clsGlobals Imports Microsoft.Xrm.Sdk.Query Imports Microsoft.Xrm.Sdk.Messages Imports CRM2013_Plugins.cls_SQLFunctions Namespace OAccountsDelete Public Class cls_OAccounts_delete Implements IPlugin Public Sub Execute(serviceProvider As System.IServiceProvider) Implements Microsoft.Xrm.Sdk.IPlugin.Execute Dim context As IPluginExecutionContext = DirectCast(serviceProvider.GetService(GetType(IPluginExecutionContext)), IPluginExecutionContext) If context.InputParameters.Contains("EntityMoniker") AndAlso TypeOf context.InputParameters("EntityMoniker") Is Entity Then Dim entity As Entity = DirectCast(context.InputParameters("EntityMoniker"), Entity) If entity.LogicalName = "new_originatingaccounts".ToLower() Then Throw New InvalidPluginExecutionException("You are not authorized to set this record as inactive") End If End If End Sub End Class End Namespace
crm tool
Dont ask me .. i dont know