Pass an entity ID to a form

Created on 23 August 2024, 10 months ago

FormBuilder allows passing of IDs for entities via URL parameters. For example, you can pass the ID of a contact via "#?Individual1=123". It would be very useful to be able to do this for a block.

An example use case is a user profile page. With the current implementation, you can set the form to autofill with the current user data. If an admin is looking at the page for a user, it will load the admin's data, not the user's data. One complexity with this use case is translating between the Drupal user ID and the Contact ID.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇦🇺Australia nicholosophy Brisbane

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @nicholosophy
  • Hi @nicholosophy,
    Maybe the latest release has implemented this feature.
    Alternatively it might be a formbuilder / searchkit update has tweaked this behaviour.

    I have achieved what you are describing by

    • Creating a Drupal page with a URL e.g /trainee
    • Creating a Formbuilder that has 'Accept ID from URL' ticked
    • Placing the Formbuilder on the page as a block with the module
    • Creating a button on a searchkit result that opens /trainee#?id=[id]&Individual1=[id]
    • .

    • In some cases I needed to add any parameter 'twice' (once before the # and then after), not sure if this is a Drupal / CiviCRM quirk that is stripping things after the # in the URL e.g /trainee?id=[id]&Individual=[id]&#?id=[id]&Individual1=[id]

    When going to the /trainee page via the searchkit link (which can also be on a Drupal page via this module), this creates fields that auto populate the correct contact information and upon submission update the correct record.

    Think this issue is now working and good to close, did you also get this to work?
    Thanks @markusa for this awesome module.

Production build 0.71.5 2024