0

Currently, when I submit a new form, there is no problem (WebFormSubmission::create() and save()). When I reload this Webform submission and modify some fields of form and record it, there is no problem (WebformSubmission::load() and save()).

But I not able to create a new Webform submission from this previous Webform submission. Aim is to have 2 independant submissions.

I tried to create() and save() after moditication but something is wrong.

3
  • 3
    Welcome to Drupal Answers. You said, but something is wrong. You'll need to be more specific than that, what error are you getting? Also, we'll need to see your code.
    – No Sssweat
    Mar 11, 2022 at 19:26
  • It sounds like you want to duplicate the submission? I don't relate to your use case for something like that but you could look into the "entity clone" module. It adds a clone operation to entities, and a webform submission is a content entity in and of itself. Mar 11, 2022 at 21:12
  • Welcome to Drupal Answers! This question seems about code you wrote. In this case, as @NoSssweat said, we need to see the code you wrote. If the question isn't about code, please edit it to make that clear and to add more details that allow us to answer it.
    – apaderno
    Mar 12, 2022 at 0:08

1 Answer 1

1

In the Webform UI, you are able to duplicate submission via the results table submission operations.

Via the Webform APIs, you can use \Drupal\webform\Entity\WebformSubmission::createDuplicate.

0

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.