3

Scenario:

A case has a Purchasing Partner role. Sometimes that needs to be changed and we want to do so via a webform (from a View with links containing whatever cid1 etc it needs).

My testing shows that if I try with just the cid1 (who is case client) and cid2 (who is existing PP) in the url and add a third cid for the new partner, when we submit the form we hope it will

  • terminate the Relationship between cid1 and cid2 (which seems to be how I can do this on a contacts record directly in civi itself and the only way i can approach this on the webform since there is no option to eg specify 'remove existing case role') and
  • create a Case Role for cid 3

the outcome is that

  • the original relationship between cid1 and cid2 remains untouched, and a new disabled (due to End Date) relationship is created between cid1 and 2
  • a new case role and relationship is created for cid 3

Should we be able to do this as webform code stands? Does adding the caseid=x help (i did test that but saw no difference)

  • Pete, I have tried every possible combination and cannot get this to work either. Unfortunately for now I have folks going into the back end to change case roles but that is not the preferred implementation in our case. Wish I had an answer for you. – pmoz Oct 28 '16 at 15:15
  • I wonder if it could be tied to the A-B relationship. When I create add a case role in Civi, it calls the relationship case manager. When I use webform to assign a case role by using the case tab on the webform it creates the relationship case manager is not case manager. – pmoz Oct 28 '16 at 15:19
  • This continues to be a big issue for me on multiple installs. Has anyone found a work-around? – pmoz Feb 15 '17 at 11:04
  • You might need to get an estimate from Coleman, maybe via drupal.org – petednz - fuzion Feb 15 '17 at 19:20
1

I just did a simple test and it appears to be working ok. This is what I did (using the latest version of CiviCRM and Webform-CiviCRM):

  • Create a simple webform with 2 contacts
  • Contact 2 - relationship to contact 1 (sibling) - relationship is active: "User Select"
  • Contact 2 "existing contact" field - autocomplete.
  • Submit the form with relationship is active: yes
  • Observe the active relationship in CiviCRM
  • Submit the form with the same 2 contacts, relationship is active: no
  • Observe the same relationship in CiviCRM is no longer active. No duplicate relationship created.

EDIT by pmoz: I wanted to make sure that the next time I need this I have clear documentation.

Create the webform with 3 contacts (Case Client, Old Case Coordinator and New Case Coordinator) and 1 ongoing case.

On the Old Case Coordinator Civi-webform settings enable relationships and select Case Coordinator as the relationship to participant and user select for is active.

You do not need to enable relationships on the New Case Coordinator Civi-webform settings. I only enable the existing contact field.

On the Civi-webform Case page, select Update Open cases, and under roles set the case client as contact 1 and the case coordinator as New Case Coordinator (contact 3).

That's it for the Civi -webform settings.

In the webform components, navigate to the Old Case Coordinator edit page and add the case role to prefill the field on the webform.

enter image description here

To access the form use node/111?cid1=caseclientid&case1=caseid. The form should be prefilled with the case client, old case coordinator and the case type if you have multiple case types.

This is the only combination that I could get to correctly add the relationship within the case.

| improve this answer | |
  • 1
    The OP related specifically to Case but this answer doesn't mention it in the steps above. So it may be a good answer, just unclear at this point. Will have a look next week – petednz - fuzion Feb 17 '18 at 22:06
  • 1
    Tested the above with a case via creating a webform with 3 contacts (all existing) and a case. Case client set to contact 1 and a 'test case role' set to be user select. Contact 2 autocompletes from relationship to Contact 1 and has 'Relationship is Active: User Select'. Submit form with Relationship is Active: NO, a contact for Contact 3 and 'Test Case Role = Contact 3". This disabled the 'Test Case Role' relationship between 1 and 2 and created a new 'Test Case Role' relationship between 1 and 3 – petednz - fuzion Mar 7 '18 at 5:04
  • 1
    Added details to the answer. – pmoz May 21 at 21:15
2

This is not currently possible so I have opened issue here.

| improve this answer | |
  • Sorry. Thought I was in the comment area. – pmoz Feb 18 '17 at 21:12
  • nw. i just edited this so it would look more like an answer ;-) – petednz - fuzion Feb 18 '17 at 21:18
0

If I understand the issue correctly, it sounds like there's a bug where webform attempts to disable a relationship but instead creates a new disabled relationship. This may be due to recent upstream changes in the Civi api - iirc the v3 relationship api is a little odd.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.