How to get value from specific key in FormTaskData?

Hi

I have created a Form Task to be assigned as a task. The user who completes the task inputs an Integer value in this case, which is then received via a Wait For Task and Resume activity.

I can use task.data.ToString which returns for example {“intVal”: 123} if the user input is 123.

Assuming I had multiple key values and I want to fetch a value by name, like “intVal” in this case which would return 123, how would I do that?

-Jon

Hi JonAndri,

The output from the activity ‘Wait for Form Task and Resume’ is of type FormTaskData. Say the output variable from this activity is named as ‘test’

  1. Create a string variable( say t1). Use assign activity to assign the value. Value would be: test.Data.Tostring(t1 = test.Data.Tostring)
  2. Create a separate Flowchart and pass t1 as input argument.
  3. Use ‘DeserializeJson’ activity to get the JObject. Say the output in your case is t2. ({“intVal”: 123})
  4. Now you can get the value of specific element you want. (t2.item(“intVal”).tostring)
  5. Invoke this workflow in the Flowcahrt in which you have created the Task.