1

I have converted a simple create contact form from Drupal 7 to Drupal 9.

In the Drupal 7 form, the confirmation would display a button with a link to the newly created contact like so:

<p><strong><span style="font-family:Trebuchet MS,Helvetica,sans-serif"><a href="/civicrm/contact/view?reset=1&cid=[submission:contact-id:2]" style="background:#792258; text-decoration: none; padding: 10px 25px; color: #ffffff; border-radius: 4px; display:inline-block; ;text-underline-color:#ff3884">VIEW YOUR CONTACT</a></span></strong></p>

So for Drupal 7, I am using the [submission:contact-id:2] token to insert the contact ID and all is fine.

I cannot get this to work in Drupal 9? It just prints [webform_submission:contact-id:2]. Other tokens do seem to work (see below). It is not the old gotcha because it is in a fieldset, it's all one simple hierarchy of six fields.

[webform_submission:values:contact-id:2]

Will just print as typed above and not show the newly created ID in the confirmation message. I have found a work around - add the contact ID field for the new contact to the form (it's hidden so OK), so using:

[webform_submission:values:civicrm_2_contact_1_contact_contact_id]

Works and outputs the correct newly created ID

This also works:

[webform_submission:contact-link:2]

outputs a full link to the new contact.

I am wondering if this is a bug to report or I'm missing some other integration or setting?

1 Answer 1

1

OK - this has driven me crazy but it was entirely a PICNIC one (Problem in Chair, Not in Computer...)

This was the issue and it must have been an accidental click somehere along the line:

enter image description here

I do not know how it got checked on and it must have been me (!), but it was a real gotcha... Unchecked and all tokens works...

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.