I am testing a proof of concept for photo uploads. I want the name of each photo to have a unique ID with a combination of the Organisation's External ID, its CiviCRM contact ID, and a random number. The Organisation is selected on the form via an auto complete and its name displayed, and its External ID and Contact ID are stored via two Hidden fields. This all works fine.

I can rename the files on submission by using the 'rename files' and the following tokens:


Each file gets stored with the unique prefix with an _1, _2 etc and so this also works as expected.

It then goes awry with CiviCRM activities. I have a CiviCRM activity attached to this form and want the Activity subject to have the same unique number. I have used exactly the same tokens but the only one that prints is [webform_submission:uuid]? I cannot get the contact ID [webform_submission:values:civicrm_2_contact_1_contact_contact_id] or External ID [webform_submission:values:civicrm_2_contact_1_contact_external_identifier] to store in the subject line. Exactly the same tokens will print fine in a confirmation screen or email. I end up with a subject of the two raw tokens and the correct UUID.

I have tried them individually (as the help says use commas to separate default values), but again, the only one that works is the UUID.

Any ideas?

1 Answer 1


Can you try changing the type of the element to computed_twig and confirm if it stores the subject correctly?

The source yaml could look like:

    '#type': computed_twig
    '#title': 'Activity Subject'
    '#prepopulate': true
    '#template': '{{ uuid }} - {{ data.civicrm_2_contact_1_contact_existing }} - {{ data.civicrm_2_contact_1_contact_external_identifier }}'
    '#store': true
    '#form_key': civicrm_1_activity_1_activity_subject
      width: 20
    '#parent': civicrm_1_activity_1_fieldset_fieldset

The above snippet assumes you have Existing Contact enabled for 2nd contact in your webform settings.

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.