1

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.

2 Answers 2

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.