Here's the scenario:

A user submits a webform that creates a case.

An administrator assigns a role in that case to a second user, and edits a specific activity (activity ID = xxx) in that case to assign that activity to the same user named for the role.

A Drupal View is used to present to that second user a link to a different webform. The link is of the form http://example.org/path/to/form?aid=xxx My understanding is that because I have appended the activity ID to the url the form submission will update the activity with that ID.

However, when I submit the form a new activity gets created and the activity with ID = xxx is not updated or affected in any way. It doesn't seem to matter which options I set for the activity within the webform. Where am I going wrong?

As a supplementary, I've noticed that for the activity that does get created (with ID = yyy), if I file that activity on the case where it should be, then the filed activity has a different ID (yyy+1), which is concerning. Surely an activity should retain the same ID number regardless of its status?

  • I've tried to achieve the activity update using many different permutations of settings on both activity and case processing tabs, still with no success. I can get it to create a new activity with no problem, but with a new activity created I can't get that activity to be filed on my target case, despite providing the case ID in the url. Surely I'm missing something obvious here?
    – Graham
    Jun 15, 2015 at 21:08

4 Answers 4


This is possible at the option update existing case and update existing activity. This option is available after you have enabled case and activity processing.

  • Thanks Jaap. I have activity processing enabled. Do I need to have case processing enabled as well?
    – Graham
    Jun 15, 2015 at 11:35
  • @jaap_jansma If I enable case processing then it looks like I need to specify the case client, which in this instance is totally irrelevant. Can I avoid this?
    – Graham
    Jun 15, 2015 at 12:00
  • I would welcome some more detail on this, as I'm not able to get the webform to update an activity. I can create an activity without a problem.
    – Graham
    Jun 17, 2015 at 6:39
  • 1
    I would think you need the case processing. When the webforms gets to complicated I usually create a drupal view just before the webform and then on the webform I would also a 2nd contact, which is the client of the case. And from the view I pass the cid2=... in the url parameter. So that this contact is prefilled. Jun 17, 2015 at 7:17

I don't think you can pass case id in the url.

I sort of asked a similar question here: http://forum.civicrm.org/index.php/topic,36136

  • Hmm, not sure about this. The code certainly appears to include reference to "caseid", but I'm not sure where it would be stored in the form as there's no option to include a case id field.
    – Graham
    Jun 20, 2015 at 8:28

What I have found is that to update an existing activity that is part of an existing case, it is insufficient to pass just the activity ID into the form via the URL. Which sort of makes sense as I can't see where that data would be stored in the webform submission (maybe it somehow gets passed into CiviCRM via the url?)

However, if I pass in the contact ID of the case client as well, and use an additional hidden existing contact field in the webform for this ID, as explained by @jaap-jansma in the comments elsewhere on this page, then this is enough data for CiviCRM to be able to identify the correct target activity in the correct case, and update the activity accordingly.

Maybe we don't need to pass in the activity ID at all, given that we can target the correct case, and use the filters available in webform_civicrm to focus on updating the correct activity? If I have time I'll test that option, and would welcome comments from others on this.

We used a Drupal View to construct and present the link to the user.

  • We are having some issues with activities submitted through a webform, Graham, did you have to enable case processing for this to work?
    – pmoz
    Sep 22, 2015 at 9:57
  • @pmoz I did have case processing enabled. It made sense in my use case. Can you share more detail about the issues you are seeing?
    – Graham
    Sep 22, 2015 at 13:09
  • Better description of my issues here: civicrm.stackexchange.com/questions/5117/…
    – pmoz
    Sep 22, 2015 at 15:24

I added a case to the webform and passed the case1 id via the URL.

I made sure the Case Type was "User Select" so CiviCRM does not expect to have case roles added, except for the case client. This was critical. When I selected a case type, the activity kept getting added instead of updated.

I passed the case client CID as a hidden contact on the webform,

I made sure the activity was File on Case 'Case1'

I made sure all the target, source and assignees bits were filled out on the activity.

I passed the activity id in the URL to populate the activity.

I passed CIDs for the target, source and assignee to populate the activity.

This magic sauce prevents an activity being added, when you want to update an existing one.

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.