/// <summary> /// Main entry point for he business logic that the plug-in is to execute. /// </summary> /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the /// <see cref="IPluginExecutionContext"/>, /// <see cref="IOrganizationService"/> /// and <see cref="ITracingService"/> /// </param> /// <remarks> /// For improved performance, PowerApps CDS caches plug-in instances. /// The plug-in's Execute method should be written to be stateless as the constructor /// is not called for every invocation of the plug-in. Also, multiple system threads /// could execute the plug-in at the same time. All per invocation state information /// is stored in the context. This means that you should not use global variables in plug-ins. /// </remarks> protected override void ExecuteCdsPlugin(LocalPluginContext localContext) { if (localContext == null) { throw new ArgumentNullException("localContext"); } IPluginExecutionContext context = localContext.PluginExecutionContext; // TODO: Implement your custom Plug-in business logic. // Check for the entity on which the plugin would be registered // if (context.InputParameters.Contains("Target") // && context.InputParameters["Target"] is Entity) // { // Entity entity = (Entity)localContext.PluginExecutionContext.InputParameters["Target"]; // // Check for entity name on which this plugin would be registered // if (entity.LogicalName == "account") // { // } // } }
/// <summary> /// Placeholder for a custom plug-in implementation. /// </summary> /// <param name="localcontext">Context for the current plug-in.</param> protected virtual void ExecuteCdsPlugin(LocalPluginContext localcontext) { // Do nothing. }