How to access Pre and Post entity images in a Custom Workflow Activity
1 min read
Charles Llamas
This post is only available in English.
For workflow extensions entity images are available using the key values PreBusinessEntity and PostBusinessEntity respectively for the pre and post entity images.
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;
public class SampleCustomActivity : CodeActivity
{
protected override void Execute(CodeActivityContext executionContext)
{
// Get the context service.
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
Entity preImage = context.PreEntityImages["PreBusinessEntity"];
Entity preImage = context.PreEntityImages["PostBusinessEntity"];
}
}
Note: PreBusinessEntity and PostBusinessEntity only works if the Workflow is a real-time workflow.