Answers.Body: <p>Our solution to this problem has been to add some code to the (custom) Wordpress plugin that sends the data from the online form to CiviCRM via API call. Just before that API call, we checked if an order contains more than one product, and if so, split it into several different API calls instead.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-04T09:54:59.200Z
Answers.LastActivityDate: 2022-01-04T09:54:59.200Z
Answers.UserDisplayName: emma
Answers.Body: <p>There may be a better way, but I would use <code>Other: Implode List</code> to get a string, then <code>Other: Modify Value with Regular Expression</code> to exract the individual fields to their own outputs.  However, you would need a separate &quot;Create Activity&quot; step for each activity, and thus would need to know the maximum number of activities you might create ahead of time.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-22T23:28:28.847Z
Answers.LastActivityDate: 2021-12-22T23:28:28.847Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I am trying to configure CiviCRM Form Processor. I am using a form with a field of type &quot;option group&quot; (let's call it the <code>Products</code> field) where customers can choose a product. They can choose multiple products at a time, which are handed over to CiviCRM as an array of strings (according to API Explorer). I want to create a CiviCRM Activity for each of these options chosen in the <code>Products</code> field.</p>
  <p>I already created an Action of type &quot;Create/Update Activity&quot; for each product, based on the condition &quot;Array parameter contains&quot; and I chose the <code>Products</code> field as the parameter. This works.
  But my problem is, when creating the Activity, a custom field should be automatically set with the product name a.k.a. option group value. That is, I do not only want to check if the output array of the <code>Products</code> field <em>contains</em> a certain value, but I also want to use that value when creating the Activity.</p>
  <p>I tried to use the pre-built Action &quot;Others: Explode List&quot; with the <code>Products</code> field as a param, to get access to each single product / option group value. But the API Explorer threw the error that this Action was given multiple values instead of a single one. So I suppose the <code>Products</code> field returns multiple values already.</p>
  <p>Now I wonder how I can use these values in my <code>create Activity</code> Actions?
  When I am editing an Action, I do have the choice to fill fields with the value of <code>Input::products</code>. But which value is that, if <code>Products</code> field returns multiple? How do I access the second value, for example?</p>
  <p>I am thankful for any hint.</p>
  
Tags: <form-processor><action-provider>
Title: How can I access multiple values returned by a Form Field in Form Processor?
ThreadText: # How can I access multiple values returned by a Form Field in Form Processor?
  
  (Asked by: username_0 on 2021-03-04)
  
  I am trying to configure CiviCRM Form Processor. I am using a form with a field of type "option group" (let's call it the `Products` field) where customers can choose a product. They can choose multiple products at a time, which are handed over to CiviCRM as an array of strings (according to API Explorer). I want to create a CiviCRM Activity for each of these options chosen in the `Products` field.
  
  I already created an Action of type "Create/Update Activity" for each product, based on the condition "Array parameter contains" and I chose the `Products` field as the parameter. This works.
  But my problem is, when creating the Activity, a custom field should be automatically set with the product name a.k.a. option group value. That is, I do not only want to check if the output array of the `Products` field *contains* a certain value, but I also want to use that value when creating the Activity.
  
  I tried to use the pre-built Action "Others: Explode List" with the `Products` field as a param, to get access to each single product / option group value. But the API Explorer threw the error that this Action was given multiple values instead of a single one. So I suppose the `Products` field returns multiple values already.
  
  Now I wonder how I can use these values in my `create Activity` Actions?
  When I am editing an Action, I do have the choice to fill fields with the value of `Input::products`. But which value is that, if `Products` field returns multiple? How do I access the second value, for example?
  
  I am thankful for any hint.
  
  **Tags:** form-processor, action-provider
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2022-01-04. Score: 1 | Accepted answer
  
  Our solution to this problem has been to add some code to the (custom) Wordpress plugin that sends the data from the online form to CiviCRM via API call. Just before that API call, we checked if an order contains more than one product, and if so, split it into several different API calls instead.
  
  
  ---
  
  ### Answer by username_1 on 2021-12-22. Score: 1
  
  There may be a better way, but I would use `Other: Implode List` to get a string, then `Other: Modify Value with Regular Expression` to exract the individual fields to their own outputs. However, you would need a separate "Create Activity" step for each activity, and thus would need to know the maximum number of activities you might create ahead of time.
  
  
  ---
  
  