title: CRM C# - Custom Workflow Activity - Input Arguments - EntityReference
body: <p>I'm Making a custom worflow activity, which is in the process . I have two inputs that are EntityReference . When I test the code appears me an error referenced to these two inputs , as shown in the figure:
  <a href="https://i.stack.imgur.com/PxdMu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PxdMu.png" alt="enter image description here"></a>
  I have a trace at the beginning of the try, but not being shown .
  There ir my code:</p>
  
  <pre><code> public class WK_DecorrerObjetivo : CodeActivity
  {
      [Input("Alvo")]
      [ReferenceTarget("xpto_alvo")]
      public InArgument&lt;EntityReference&gt; alvo { get; set; }
  
      [Input("Actividade do Objetivo")]
      [ReferenceTarget("xpto_atividadedeobjetivo")]
      public InArgument&lt;EntityReference&gt; atividadeObjetivo { get; set; }
  
      protected override void Execute(CodeActivityContext Execontext)
      {
  
          ITracingService _tracing;
          IWorkflowContext context = null;
          IOrganizationServiceFactory serviceFactory = null;
          IOrganizationService service = null;  
          OrganizationServiceContext serviceContext = null;
  
          try
          {
              #region Get Work Flow Context
  
              context = Execontext.GetExtension&lt;IWorkflowContext&gt;();
              serviceFactory = Execontext.GetExtension&lt;IOrganizationServiceFactory&gt;();
              service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);
              serviceContext = new OrganizationServiceContext(service);
  
              _tracing = Execontext.GetExtension&lt;ITracingService&gt;();
              _tracing.Trace("Here");
              EntityReference alvoRef = alvo.Get(Execontext);
              EntityReference atividadeObjetivoRef = atividadeObjetivo.Get(Execontext);
            }
            catch() {}
         }
  </code></pre>
  
  <p>Can anyone help?</p>