2

Getting this error out of sudden: apparently the only thing changed was "CRM/Core/Payment.php" file moved to the custom php directory and a "City" field attribute changed to "not required"

API error: 'afform_type' is not a valid option for field option_group_id on OptionValue.create( entity name form)"

Indeed, 'option_group_id' in the civicrm_option_value table is of type INT, while new record creation API call looks like this:

[id] => 1303

[is_active] => 1

[option_group_id] => afform_type

[name] => form

[value] => form

[label] => Submission Form

[weight] => 0

[icon] => fa-list-alt

[version] => 3

This is clearly broken but I have not a slightest clue why: nothing has been changed since yesterday.

1
  • I'm having the same issue, and the error appears when trying to 'Install' the 'Form core' extension (previously called afform). This problem seems to emerge whenever CiviCRM tries to rebuild the managed entities list: ie: enabling/disabling modules/extensions.
    – John
    Commented Aug 31, 2022 at 14:19

1 Answer 1

4

I found the same issue with two extensions on my site: Form core (aka afform) and Search kit.

I checked my database and in the civicrm_managed table there were references to the option group, but the option group did not exist with the specified ID in the civicrm_option_group table.

To fix this issue I:

  • Disabled and uninstalled Form core (ignoring any error messages about the missing option group)
  • Manually removed the broken entries from civicrm_managed, using:

DELETE FROM civicrm_managed WHERE module = 'org.civicrm.afform';

  • Re-installed Form core

And the managed entities were then installed correctly.

The same process worked for a similar problem with the Searchkit extension.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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