Closed davejenx closed 12 months ago
Was there existing activity status name Failed
present before cmsuser extension installation ? mgd.php
check existing entry before creating new one...
Hi @sunilpawar , yes it looks as though there was an existing activity status for Failed before the extension was installed. The earlier option had description = NULL whereas the .mgd.php file has description = "Activity failed." I wonder if that discrepancy is what caused the duplicate to be created?
+------+-----------------+--------+-------+--------+----------+--------+------------+--------+------------------+-------------+-------------+-----------+--------------+-----------+---------------+------+-------+
| id | option_group_id | label | value | name | grouping | filter | is_default | weight | description | is_optgroup | is_reserved | is_active | component_id | domain_id | visibility_id | icon | color |
+------+-----------------+--------+-------+--------+----------+--------+------------+--------+------------------+-------------+-------------+-----------+--------------+-----------+---------------+------+-------+
| 920 | 26 | Failed | 9 | Failed | NULL | 1 | 0 | 9 | NULL | 0 | 0 | 1 | NULL | NULL | NULL | NULL | NULL |
| 1019 | 26 | Failed | 10 | Failed | NULL | 0 | 0 | 10 | Activity failed. | 0 | 0 | 1 | NULL | NULL | NULL | NULL | NULL |
+------+-----------------+--------+-------+--------+----------+--------+------------+--------+------------------+-------------+-------------+-----------+--------------+-----------+---------------+------+-------+
@davejenx Have you tried deleting the old activity status if it is not used anywhere?
Was getting the following error when submitting a webform:
The website encountered an unexpected error. Please try again later.
Drupal\Core\Entity\EntityStorageException: Expected one OptionValue but found 2 in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 811 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\webform_civicrm\Utils->wf_civicrm_api('EntityTag', 'create', Array) (Line: 1003) Drupal\webform_civicrm\WebformCivicrmPostProcess->addOrRemoveMultivaluedData('tag', 'contact', '140215', Array, Array) (Line: 910) Drupal\webform_civicrm\WebformCivicrmPostProcess->saveGroupsAndTags(Array, '140215', 2) (Line: 265) Drupal\webform_civicrm\WebformCivicrmPostProcess->preSave(Object) (Line: 137) ...
Tracked it down to a Civi API call in the CMS Users extension where it gets the value of the activity_status option value for "Failed". There were 2 such options. Looks like the extra one was created based on CRM/Cmsuser/Activities.mgd.php: this has description = "Activity failed." whereas the existing one had description NULL.
I worked around it by removing the new option value & setting the description of the existing one to "Activity failed."