1

On my latest Civi 5.37.2 the params array passed to hook_civicrm_pre looks like:

Array
(
    [hidden_custom] => 1
    [hidden_custom_group_count] => Array
        (
            [] => 1
        )
    [custom_395_-1] =>          <-------- Spooky appdx
    [custom_463_-1] => 1000     <-------- Spooky appdx
 [...]

This happens when adding a new activity to a case. hook_civicrm_customPre works in other cases but it is not fired here. So it seems, there is no hook to get a sane custom_<fieldid> param prior saving to db.

4
  • I think it's always been like this? And for editing an existing one it's not -1 it's the autoincrement id in the customvalue table. – Demerit Jun 15 at 20:24
  • Jesus, I should have derived this from my dotnet and other orms development experience. Will you answer? – nielo Jun 15 at 21:03
  • He he I thought this was a unique civi thing - maybe not. – Demerit Jun 15 at 21:38
  • No, using negative temporary ids is quite common, I think. Thanks a load! – nielo Jun 16 at 8:55
1

Converted comment to answer:

I think it's always been like this? And for editing an existing one it's not -1 it's the autoincrement id in the customvalue table.

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.