Finally, it was time to test this, and itβs quite possible to get preliminary values ββin a workflow by assembling a workflow.
Here is what I did:
I created a workflow on contact with a trigger by LastName. The workflow contains a link to the name of the last field and its own assembly of the workflow . I opened a contact and changed its name from "Foo" to "Bar"
Custom Workflow Build Code:
protected override void Execute(CodeActivityContext context) { IWorkflowContext workflow = context.GetExtension<IWorkflowContext>(); Entity preImage = workflow.PreEntityImages.Values.FirstOrDefault(); string content = RetrievePreImageLastname(preImage); using (StreamWriter writer = new StreamWriter(@"C:\temp\log.txt", true)) { writer.WriteLine("writing workflow assembly"); writer.Write(content); } } public string RetrievePreImageLastname(Entity value) { if (value == null) return "PreImage is Empty"; return string.Format("lastname pre image value: {0}", value.GetAttributeValue<string>("lastname")); }
And that was the result:
workflow assembly
last preview value: foo
We hope this helps anyone in the future.
source share