title: CRM workflow: How to get all the records from a subgrid as a list of entities and perform multi-retrieve
body: <p>As the title suggests, I do not know how to convert entity.attributes ["subgrid"] as a list of entities, on which to run the multiretrieve:</p>
  
  <p>My code for now:</p>
  
  <pre><code>protected override void Execute(CodeActivityContext executionContext)
      {
          ITracingService tracingService = executionContext.GetExtension&lt;ITracingService&gt;();
          IWorkflowContext context = executionContext.GetExtension&lt;IWorkflowContext&gt;();
          IOrganizationServiceFactory serviceFactory = executionContext.GetExtension&lt;IOrganizationServiceFactory&gt;();
          IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
  
          var entity = (Entity)context.InputParameters["Target"];
  
          if (entity.LogicalName != "account")
          {
              return;
          }
          var currentAccountId = entity.Id;
          try
          {
              if (!entity.Contains("Subgrid"))
              {
                  return;
              }
              var itemsOnSubgrid = entity.Attributes["Subgrid"];
              if(itemsOnSubgrid == null)
              {
                  return;
              }
              else
              {
                  //if subgrid exist and is not null
                  //List of entities needed
              }
          }
          catch (Exception ex)
          {
              tracingService.Trace("MyWorkflow: {0}", ex.ToString());
              throw new InvalidPluginExecutionException(ex.Message);
          }
      }
  </code></pre>