Quantcast
Channel: CRM Development 論壇
Viewing all articles
Browse latest Browse all 10280

pass field value to plugin that uses Entity Reference

$
0
0

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


Viewing all articles
Browse latest Browse all 10280

Trending Articles



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