title: Sharepoint 2013 Workflow - How to build String[] from a dynamic value
body: <p>How do I build a String[] from a dynamic value?</p>
  
  <p>I have an Initiation form that I collect email information and pass to my workflow as an Argument of type string </p>
  
  <pre><code>function StartWorkflow() {
   var wfParams = new Object(); 
   //build array of objects
   var emailUsers = new Array();
   //cycle through viewmodel emails
   for (var i = 0; i &lt; viewModel.SelectedEmails().length; i++)
         {
                      var a = new Object();
                      a["emails"] = viewModel.SelectedEmails()[i];
                      emailUsers.push(a);
          }
    wfParams['strSelectedEmailsHMgr'] = JSON.stringify(emailUsers);
  
  
  **This all works fine!**
  </code></pre>
  
  <p>IN my SharePoint 2013 workflow, I then create a dynamic Value variable called dvJSON.
  Next, I add a ParseDynamicValue activity and set my variable dvJSON to my incoming argument    wfParams['strSelectedEmailsHMgr'].</p>
  
  <p>Next, I add a WirteToHistory activity.
  here's the result:
  The value of dvJSON is [{"emails":"tom.daria@fhlbcin.com"},{"emails":"tom.daria@fhlbcin.com"},{"emails":"tomdaria@yahoo.com"},{"emails":"tomdaria@yahoo.com"},{"emails":"tom.daria@fhlbcin.com"}]   </p>
  
  <p>Next, I add GetDynamicValueProperty and set the ProperyName to "emails" source dvJSONa result reciepients (string array variable).</p>
  
  <p>I then Deploy my solution.
  When I start my workflow, I am presented with my custom initiation form.
  I select my email users and click Start button to start the workflow.</p>
  
  <p>The GetDynamicValueProperty fails.</p>
  
  <p>Here is the error below.</p>
  
  <pre><code>RequestorId: d8a1f1c4-4b83-da9c-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.InvalidOperationException: Looking up a value using a key is not supported on an instance of 'Microsoft.Activities.Dynamic.DynamicJsonArray'. at Microsoft.Activities.Dynamic.DynamicItem.TryGetValue(String key, DynamicItem&amp; value) at Microsoft.Activities.Dynamic.DynamicValueBuilder.PathSegmentFactory.ObjectPathSegment.Get(DynamicItem obj) at Microsoft.Activities.GetDynamicValueProperty`1.Execute(CodeActivityContext context) at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
  </code></pre>
  
  <p>Thanks 
  Tom</p>