MSCrm 2011 - Workflow Assembly Get Current Entity ID
This is a workflow assembly that returns the current record ID
(Guid) in Dynamics crm 2011.
There is only one drawback, It won't work in Dynamics CRM 2011
ONLINE because workflow assemblies aren't supported there.
Code:
public class GetEntityId : CodeActivity
{
protected override void
Execute(CodeActivityContext executionContext)
{
//Create the tracing
service
ITracingService
tracingService = executionContext.GetExtension<ITracingService>();
IWorkflowContext context
= executionContext.GetExtension<IWorkflowContext>();
EntityId.Set(executionContext, context.PrimaryEntityId.ToString());
}
[Output("Entity Id")]
public OutArgument<string> EntityId
{ get; set; }
}
Walkthrough:
1) Copy the .dll from the bin folder to <%CRM
folder%>\Server\bin\assembly
2) Use the plugin registration tool to register the workflow
assembly
3) Now you should be able to see it in the Workflow window:
4) After you added it to the Workflow you can use it:
Download Link: https://docs.google.com/open?id=0B8k6R6QcCN7INjU2ZjIwMGQtYTBjYy00MmQ1LWI1ZWQtODg0OWViYmQ3YzRl
Dynamics CRM 2011 ONLINE users walkaround:
Create plugin on post create step insert the id to some
text field.
The plugin has advantage, as it will work on all environments
Plugin version: http://dynamicslollipops.blogspot.com/2011/11/mscrm-2011-get-guid-plugin.html