1.0 Problem/Motivation
Webform CiviCRM Integration breaks Webform draft

Error: Call to a member function getFormObject() on null in wf_crm_webform_postprocess->submissionValue() (line 2551 of /path/web/modules/contrib/webform_civicrm/includes/wf_crm_webform_postprocess.inc)

#0 /path/web/modules/contrib/webform_civicrm/includes/wf_crm_webform_postprocess.inc(580): wf_crm_webform_postprocess->submissionValue('civicrm_2_conta...')
#1 /path/web/modules/contrib/webform_civicrm/includes/wf_crm_webform_postprocess.inc(165): wf_crm_webform_postprocess->getExistingContactIds()
#2 /path/web/modules/contrib/webform_civicrm/src/Plugin/WebformHandler/CivicrmWebformHandler.php(145): wf_crm_webform_postprocess->preSave(Object(Drupal\webform\Entity\WebformSubmission))
#3 /path/web/modules/contrib/webform/src/Entity/Webform.php(2707): Drupal\webform_civicrm\Plugin\WebformHandler\CivicrmWebformHandler->preSave(Object(Drupal\webform\Entity\WebformSubmission), NULL, NULL)
#4 /path/web/modules/contrib/webform/src/WebformSubmissionStorage.php(1210): Drupal\webform\Entity\Webform->invokeHandlers('preSave', Object(Drupal\webform\Entity\WebformSubmission), NULL, NULL)
#5 /path/web/modules/contrib/webform/src/WebformSubmissionStorage.php(974): Drupal\webform\WebformSubmissionStorage->invokeWebformHandlers('preSave', Object(Drupal\webform\Entity\WebformSubmission))
#6 /path/web/modules/contrib/webform_encrypt/src/WebformEncryptSubmissionStorage.php(244): Drupal\webform\WebformSubmissionStorage->doPreSave(Object(Drupal\webform\Entity\WebformSubmission))
#7 /path/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(454): Drupal\webform_encrypt\WebformEncryptSubmissionStorage->doPreSave(Object(Drupal\webform\Entity\WebformSubmission))
#8 /path/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(837): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\webform\Entity\WebformSubmission))

2.0 Detailed steps to reproduce (embed screenshots)
Create a Webform
Activate draft & check working
Enable CiviCRM Processing
Draft stop working

Comments

andrimont created an issue. See original summary.

andrimont’s picture

Title: WF » Webform CiviCRM breaks draft
andrimont’s picture

I noticed that there is similar error when using the "previous page" button.

Error : Call to a member function getFormObject() on null dans wf_crm_webform_postprocess->submissionValue() (/path/web/modules/contrib/webform_civicrm/includes/wf_crm_webform_postprocess.inc ligne 2551)
#0 /path/web/modules/contrib/webform_civicrm/includes/wf_crm_webform_postprocess.inc(580): wf_crm_webform_postprocess->submissionValue('civicrm_1_conta...')
#1 /path/web/modules/contrib/webform_civicrm/includes/wf_crm_webform_postprocess.inc(165): wf_crm_webform_postprocess->getExistingContactIds()
#2 /path/web/modules/contrib/webform_civicrm/src/Plugin/WebformHandler/CivicrmWebformHandler.php(145): wf_crm_webform_postprocess->preSave(Object(Drupal\webform\Entity\WebformSubmission))
#3 /path/web/modules/contrib/webform/src/Entity/Webform.php(2707): Drupal\webform_civicrm\Plugin\WebformHandler\CivicrmWebformHandler->preSave(Object(Drupal\webform\Entity\WebformSubmission), NULL, NULL)
aayushdahal’s picture

Assigned: Unassigned » aayushdahal

I will try to reproduce this issue and get back to you!

aayushdahal’s picture

@andrimont

(Screenshots attached)
As per your reproduction step "Activate draft & check working"; I went to Submission Settings -> Submission Draft Settings -> Allow your users to save and finish the webform later -> and then checked off the radio button "Authenticated and anonymous users.

After this step, a "Save Draft" button appeared in my webform, and when I press it, I do get an error:

Error: Call to a member function getFormObject() on null in Drupal\webform_civicrm\WebformCivicrmPostProcess->submissionValue() (line 2670 of /var/www/drupal/web/sites/default/modules/webform_civicrm/src/WebformCivicrmPostProcess.php)

aayushdahal’s picture

@andrimont
Please let me know if my reproduction for the issue was how you did it, if not, please let me know how you did the step "Active draft & check working".

aayushdahal’s picture

karing’s picture

Assigned: jitendrapurohit » petednz

Hi @petednz - would this be functionality that is important to Fuzion? We really don't use this - but happy to ask J to put some time into it if you do.

karing’s picture

Assigned: petednz » jitendrapurohit
jitendrapurohit’s picture

jitendrapurohit’s picture

Status: Active » Needs review
karing’s picture

@andrimont - my team has reproduced, fixed issue and will also test the PR [@aayushdahal - could you please add PR 592 to your list?]

Please note that for we will be starting to prioritize active community member requests - please see https://www.drupal.org/project/webform_civicrm for ways to contribute back/get involved.

aayushdahal’s picture

@KarinG Will do!

andrimont’s picture

Hello all,
Thanks you @jitendrapurohit, @KarinG and @aayushdahal
In a D9 site, I still get the error using the Draft :
Error: Call to a member function getFormObject() on null in Drupal\webform_civicrm\WebformCivicrmPostProcess->submissionValue() (line 2670 of modules/contrib/webform_civicrm/src/WebformCivicrmPostProcess.php). .

karing’s picture

Did you pull in PR 592? Did you clear caches?

We will still test this manually but the PR we added includes an automated test that is passing on 3 Drupal/CiviCRM combinations, including D9.

karing’s picture

We have manually tested https://github.com/colemanw/webform_civicrm/pull/592 - and it is now merged.

karing’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.