Thanks this forum I have advanced my knowledge in crm by leaps and bounds. I with the help of Rockstar I have successfully managed to fire a plugin from a record being deactivated to throw an error ( code below ) . This made me think, can a value from the deactivated record be passed to the plugin. in this instance, I would like to pass the field value of new_accountkey which is a text field.
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 EntityReference Then Throw New InvalidPluginExecutionException("You are not authorized to set this record as inactive ")" I want to add the value of new_accountkey to the error message" End If End Sub End Class End Namespace
Dont ask me .. i dont know