Answers.Body: <p>I have recently (with the latest CiviRules version) succesfully used this rule in combination with the same condition. My first step would be to check your activity types and make sure there is not a double one in there (with the same name rather than label)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-28T11:05:29.087Z
Answers.Text: Hi Erik there are no duplicates names in activity types. I've tried with activity types I created as well as built in civi types eg meeting - always with same error message. I upgraded to 2.1 first. Once I hit this error I also tried manual install (having deleted all civirules tables first. Could it be a wordpress issue or civi 5.22? And thanks for such a brilliant extension!
Answers.UserDisplayName: LesleyJill
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-29T06:37:15.887Z
Answers.Text: Glad to hear you like it :-) It could be a 5.22 issue, the error seems to suggest a CiviCRM issue rather than a WP issue. The error says that it found 2 activity types where it expected only 1. Is there any way tyou could send me a dump of your civicrm_option_value table? (erik dot hommel at civicoop dot org)
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-29T13:44:32.253Z
Answers.Text: sure thing - I've just sent as csv and sql.
Answers.UserDisplayName: LesleyJill
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-29T13:53:34.857Z
Answers.Text: You're on the right track for sure. I just successfully added activity parameter in fresh 5.22 install. But once I stuck my civicrm_option_value table in there I reproduced the error. I can't see any duplicates in activity option group (id-2), but there are heaps through out the table. Hopefully you can spot something. Maybe there's just too many? And again many thanks
Answers.UserDisplayName: LesleyJill
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-02T05:50:16.163Z
Answers.Text: Got your list, will do a quick check....
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-02T11:28:01.560Z
Answers.Text: I can not see any duplicates either, but something is wrong with that table somehow.....
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-17T23:00:48.780Z
Answers.Text: I'm getting around it by putting the activity parameter straight into the dbase via phpmyadmin. You still can't get into the rule in civi to edit it (same error) but at least it works...
Answers.UserDisplayName: LesleyJill
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-17T23:03:05.347Z
Answers.Text: Also if you use add activity as a trigger then add activity type as a condition it works fine ie doesn't have any problems with the civicrm_option_value table. So what's the difference?
Answers.UserDisplayName: LesleyJill
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-30T05:41:11.423Z
Answers.Text: You tell me! I can not replicate your problem in my local test environment so far.
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-30T18:48:01.937Z
Answers.Text: Hey Erik hope you had a good holiday. Thanks for persevering with this. Are you saying you can’t duplicate this using my option_value_table in your local environment? If that’s the case then doesn’t it have to be a 5.22 thing? I might give my suspect table a try in some other Civi versions.
Answers.UserDisplayName: LesleyJill
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-31T09:50:42.663Z
Answers.Text: I had a great holiday, thanks! I will try once more tonight in my environment and mail you the resulting screen shots.
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-28T06:29:21.130Z
Answers.LastActivityDate: 2018-06-28T06:29:21.130Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>wordpress 4.9 civi5.22 civirules 2.1</p>
  
  <p>Add an action "add activity to contact"
  Then try to add condition (ie activity type) produces error ""CiviCRM_API3_Exception: "Expected one OptionValue but found 2"
  no choice but to return to home page.</p>
  
  <p>A popup then confirms that activity parameter is saved (and it is added to civirule_rule_action table)</p>
  
  <p>The rule does actually work but can no longer be accessed - any attempt to edit results in same error message. Also can't be deleted.</p>
  
  <p>backtrace and full error as follows:</p>
  
  <pre><code>CiviCRM_API3_Exception: "Expected one OptionValue but found 2"
  
  #0 /home/domain/public_html/wp-content/uploads/civicrm/ext/org.civicoop.civirules/CRM/CivirulesActions/Activity/Add.php(103): civicrm_api3("OptionValue", "getvalue", (Array:3))
  #1 /home/domain/public_html/wp-content/uploads/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Form/Rule.php(387): CRM_CivirulesActions_Activity_Add-&gt;userFriendlyConditionParams()
  #2 /home/domain/public_html/wp-content/uploads/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Form/Rule.php(282): CRM_Civirules_Form_Rule-&gt;getRuleActions()
  #3 /home/domain/public_html/wp-content/uploads/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Form/Rule.php(258): CRM_Civirules_Form_Rule-&gt;createUpdateFormElements()
  #4 /home/domain/public_html/wp-content/uploads/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Form/Rule.php(34): CRM_Civirules_Form_Rule-&gt;createFormElements()
  #5 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(570): CRM_Civirules_Form_Rule-&gt;buildQuickForm()
  #6 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Display.php(92): CRM_Core_Form-&gt;buildForm()
  #7 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display-&gt;perform(Object(CRM_Civirules_Form_Rule), "display")
  #8 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller-&gt;handle(Object(CRM_Civirules_Form_Rule), "display")
  #9 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page-&gt;handle("display")
  #10 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(113): CRM_Core_Controller-&gt;run()
  #11 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(283): CRM_Utils_Wrapper-&gt;run("CRM_Civirules_Form_Rule", "Rule", NULL)
  #12 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
  #13 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
  #14 /home/domain/public_html/wp-content/plugins/civicrm/civicrm.php(1246): CRM_Core_Invoke::invoke((Array:4))
  #15 [internal function](): CiviCRM_For_WordPress-&gt;invoke("")
  #16 /home/domain/public_html/wp-includes/class-wp-hook.php(286): call_user_func_array((Array:2), (Array:1))
  #17 /home/domain/public_html/wp-includes/class-wp-hook.php(310): WP_Hook-&gt;apply_filters("", (Array:1))
  #18 /home/domain/public_html/wp-includes/plugin.php(453): WP_Hook-&gt;do_action((Array:1))
  #19 /home/domain/public_html/wp-admin/admin.php(224): do_action("toplevel_page_CiviCRM")
  #20 {main}
  </code></pre>
  
Tags: <civirules>
Title: Civirules can't add activity parameter "CiviCRM_API3_Exception: "Expected one OptionValue but found 2
ThreadText: # Civirules can't add activity parameter "CiviCRM_API3_Exception: "Expected one OptionValue but found 2
  
  (Asked by: username_0 on 2018-06-27)
  
  wordpress 4.9 civi5.22 civirules 2.1
  Add an action "add activity to contact"
  Then try to add condition (ie activity type) produces error ""CiviCRM_API3_Exception: "Expected one OptionValue but found 2"
  no choice but to return to home page.
  A popup then confirms that activity parameter is saved (and it is added to civirule_rule_action table)
  The rule does actually work but can no longer be accessed - any attempt to edit results in same error message. Also can't be deleted.
  backtrace and full error as follows:
  CiviCRM_API3_Exception: "Expected one OptionValue but found 2"
  
  #0 /home/domain/public_html/wp-content/uploads/civicrm/ext/org.civicoop.civirules/CRM/CivirulesActions/Activity/Add.php(103): civicrm_api3("OptionValue", "getvalue", (Array:3))
  #1 /home/domain/public_html/wp-content/uploads/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Form/Rule.php(387): CRM_CivirulesActions_Activity_Add->userFriendlyConditionParams()
  #2 /home/domain/public_html/wp-content/uploads/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Form/Rule.php(282): CRM_Civirules_Form_Rule->getRuleActions()
  #3 /home/domain/public_html/wp-content/uploads/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Form/Rule.php(258): CRM_Civirules_Form_Rule->createUpdateFormElements()
  #4 /home/domain/public_html/wp-content/uploads/civicrm/ext/org.civicoop.civirules/CRM/Civirules/Form/Rule.php(34): CRM_Civirules_Form_Rule->createFormElements()
  #5 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(570): CRM_Civirules_Form_Rule->buildQuickForm()
  #6 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Display.php(92): CRM_Core_Form->buildForm()
  #7 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Civirules_Form_Rule), "display")
  #8 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Civirules_Form_Rule), "display")
  #9 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("display")
  #10 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(113): CRM_Core_Controller->run()
  #11 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(283): CRM_Utils_Wrapper->run("CRM_Civirules_Form_Rule", "Rule", NULL)
  #12 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
  #13 /home/domain/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
  #14 /home/domain/public_html/wp-content/plugins/civicrm/civicrm.php(1246): CRM_Core_Invoke::invoke((Array:4))
  #15 [internal function](): CiviCRM_For_WordPress->invoke("")
  #16 /home/domain/public_html/wp-includes/class-wp-hook.php(286): call_user_func_array((Array:2), (Array:1))
  #17 /home/domain/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters("", (Array:1))
  #18 /home/domain/public_html/wp-includes/plugin.php(453): WP_Hook->do_action((Array:1))
  #19 /home/domain/public_html/wp-admin/admin.php(224): do_action("toplevel_page_CiviCRM")
  #20 {main}
  
  **Tags:** civirules
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-06-28. Score: 1
  
  I have recently (with the latest CiviRules version) succesfully used this rule in combination with the same condition. My first step would be to check your activity types and make sure there is not a double one in there (with the same name rather than label)
  
  > **Comments:**
  > **username_0**: Hi Erik there are no duplicates names in activity types. I've tried with activity types I created as well as built in civi types eg meeting - always with same error message. I upgraded to 2.1 first. Once I hit this error I also tried manual install (having deleted all civirules tables first. Could it be a wordpress issue or civi 5.22? And thanks for such a brilliant extension!  
  > **username_1**: Glad to hear you like it :-) It could be a 5.22 issue, the error seems to suggest a CiviCRM issue rather than a WP issue. The error says that it found 2 activity types where it expected only 1. Is there any way tyou could send me a dump of your civicrm_option_value table? (erik dot hommel at civicoop dot org)  
  > **username_0**: sure thing - I've just sent as csv and sql.  
  > **username_0**: You're on the right track for sure. I just successfully added activity parameter in fresh 5.22 install. But once I stuck my civicrm_option_value table in there I reproduced the error. I can't see any duplicates in activity option group (id-2), but there are heaps through out the table. Hopefully you can spot something. Maybe there's just too many? And again many thanks  
  > **username_1**: Got your list, will do a quick check....  
  > **username_1**: I can not see any duplicates either, but something is wrong with that table somehow.....  
  > **username_0**: I'm getting around it by putting the activity parameter straight into the dbase via phpmyadmin. You still can't get into the rule in civi to edit it (same error) but at least it works...  
  > **username_0**: Also if you use add activity as a trigger then add activity type as a condition it works fine ie doesn't have any problems with the civicrm_option_value table. So what's the difference?  
  > **username_1**: You tell me! I can not replicate your problem in my local test environment so far.  
  > **username_0**: Hey Erik hope you had a good holiday. Thanks for persevering with this. Are you saying you can’t duplicate this using my option_value_table in your local environment? If that’s the case then doesn’t it have to be a 5.22 thing? I might give my suspect table a try in some other Civi versions.  
  > **username_1**: I had a great holiday, thanks! I will try once more tonight in my environment and mail you the resulting screen shots.  
  
  ---
  
  