How to access Pre and Post entity images in a Custom Workflow Activity

Avatar
Oct 17, 2019  1 min read

Entity Images for workflow extensions

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.


Reference: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/workflow/workflow-extensions#entity-images-for-workflow-extensions


Comments
Be the first to comment.
Loading...