I have a rule that runs on 'After saving a new user account.' The user account has a custom field on it call 'Drupal ID' -- it's a plain text field, that actually contains the SID for a webform submission that person created anonymously in the past.

I'm trying to delete that particular webform submission using rules, but no matter what entities I fetch, the action, 'Fetch webform submissions' refuses to give me token access to that field. I am using that account:field-drupal-id value in the same rule in another action! Why can't I use it as the SID source to fetch a certain webform submission???

All I'm getting under the account for tokens in the SUBMISSION ID field are:

account:uid
account:roles
account:status

When I instead try to 'Fetch an Entity' of type 'Webform Submission' I can't choose anything useful for the PROPERTY field ('The property by which the entity is to be selected). The User Account object is not listed, so I can't use any account fields. I can put account:field-drupal-id in here directly, but the page tells me it's not valid, so I can't save it.

What to do?

Comments

amaisano’s picture

Issue summary: View changes
amaisano’s picture

Why aren't user properties or fields showing up as available here?

Glitch

hardik jayeshbhai hihoriya’s picture

Get data From the submitted web form using below code get

/** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
$webform_submission = \Drupal\webform\entity\WebformSubmission::load($sid);

// Get submission data.
$data = $webform_submission->getData();

OR

$storage = \Drupal::entityTypeManager()->getStorage('webform_submission');
$webform_submission = $storage->loadByProperties([
  'entity_type' => 'node',
  'entity_id' => $variables['node']->id(),
]);
$submission_data = array();
foreach ($webform_submission as $submission) {
  $submission_data[] = $submission->getData();
}