Answers.Body: <p>Looks like this was a bug in the comparison logic. See if this fix works for you:
  <a href="https://github.com/colemanw/webform_civicrm/pull/17" rel="nofollow">https://github.com/colemanw/webform_civicrm/pull/17</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-25T15:37:41.477Z
Answers.Text: Thanks Coleman.  I'll check it out tonight or tomorrow when I get home from the User Summit!
Answers.UserDisplayName: pmoz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-26T01:40:48.920Z
Answers.Text: Your fix appears to do the trick!  Have I told you lately how awesome you guys are (aside from a few hours ago)?
Answers.UserDisplayName: pmoz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-26T02:13:52.923Z
Answers.Text: Cool, glad it works for you.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-25T15:25:33.827Z
Answers.LastActivityDate: 2015-09-25T15:25:33.827Z
Answers.UserDisplayName: Coleman
Answers.Body: <p>Not an answer per se, more a comment, but too long to fit in the comment box:</p>
  
  <p>For me this sounds like a bug. I've just checked the set-up I'm using for a very similar scenario, where I'm creating a new activity and filing it on a pre-existing case. Case processing is not enabled, and the activity is being created as I expect in the correct case, where I am passing in the case client id into a hidden field in the form.</p>
  
  <p>As you are specifying 'Test Case' as the case type for the 'File on Case' section then I would say there is no way that the activity should be getting filed anywhere other than in a Test Case, hence my assertion that there is a bug at work here. In my case I'm only working with one case type so I've not come across this issue.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-22T17:55:11.703Z
Answers.Text: Thanks Graham, I experience the same issue on the development server.
Answers.UserDisplayName: pmoz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-22T18:16:28.800Z
Answers.Text: When the activity is filed on the wrong case, it seems to go to the highest case_id (or in other words, most recently opened case). Never does it appear to go to the lower numbered case.
Answers.UserDisplayName: pmoz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-23T08:35:40.637Z
Answers.Text: Which suggests to me that it isn't filtering for case type at all, despite what you've told it to do, and is simply going for the first case it can find based on the other criteria.
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-24T20:44:58.013Z
Answers.Text: I went to try a user select field for the Case Type and that isn't an option in the activities section.  I'm out of ideas.
Answers.UserDisplayName: pmoz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-22T17:52:23.757Z
Answers.LastActivityDate: 2015-09-22T17:52:23.757Z
Answers.UserDisplayName: Graham
Body: <p>Drupal 7.39
  Webform Civi Integration version 7.x-4.11.</p>
  
  <p>Just noticed that for contacts with multiple open case types, a new activity submitted via a webform does not always go to the correct case type.</p>
  
  <p>In the Civi Webform settings under Activities, File on Case section I have Test Case as the Case Type, open and resolved selected under Case Status and contact 2 selected for Case Client.  </p>
  
  <p>Nothing selected under the Case section of the webform.  In the past, I didn't add anything here for an activity on an already open case.  Should I be using this section if the case is already open or is this section just for changing case roles, status, etc.?</p>
  
  <p>One case client has two open cases, an open Test Case and an open Other Case Type.</p>
  
  <p>When I click on the link to add a New Test Case Activity, the correct webform comes up with the correct client name.  Once submitted however, the activity is filed under Other Case Type and not Test Case.</p>
  
  <p>If I use the same form for someone with only a Test Case, the activity is created in the correct case.</p>
  
  <p>I tried with enabling the Case processing section, but still encounter the same error.</p>
  
  <p>I thought I had this working before, but I could be wrong.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-22T11:43:32.203Z
Comments.Text: If I enable case processing, will that allow me to add the case id to the url for more specific targeting?
Comments.UserDisplayName: pmoz
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-22T13:39:53.203Z
Comments.Text: In the Case processing section, what options did you have set?
Comments.UserDisplayName: Graham
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-22T15:23:28.090Z
Comments.Text: For Update Existing Case I had Ongoing, Case Type I selected the specific case type, Case Status was set to Ongoing, for the Case Role section I had Case Client set to cid2, Case Creator set to automatic (although I am not opening a case with this activity) and Case Coordinator set to none.  I tried it lie that, then I tried it with Select None in the Case Roles section.
Comments.UserDisplayName: pmoz
Tags: <activities><civicase><webform-civicrm>
Title: Webform created for case activity and multiple case types
ThreadText: # Webform created for case activity and multiple case types
  
  (Asked by: username_0 on 2015-09-01)
  
  Drupal 7.39
  Webform Civi Integration version 7.x-4.11.
  
  Just noticed that for contacts with multiple open case types, a new activity submitted via a webform does not always go to the correct case type.
  
  In the Civi Webform settings under Activities, File on Case section I have Test Case as the Case Type, open and resolved selected under Case Status and contact 2 selected for Case Client.
  
  Nothing selected under the Case section of the webform. In the past, I didn't add anything here for an activity on an already open case. Should I be using this section if the case is already open or is this section just for changing case roles, status, etc.?
  
  One case client has two open cases, an open Test Case and an open Other Case Type.
  
  When I click on the link to add a New Test Case Activity, the correct webform comes up with the correct client name. Once submitted however, the activity is filed under Other Case Type and not Test Case.
  
  If I use the same form for someone with only a Test Case, the activity is created in the correct case.
  
  I tried with enabling the Case processing section, but still encounter the same error.
  
  I thought I had this working before, but I could be wrong.
  
  **Tags:** activities, civicase, webform-civicrm
  
  > **Comments:**
  > **username_0**: If I enable case processing, will that allow me to add the case id to the url for more specific targeting?  
  > **username_1**: In the Case processing section, what options did you have set?  
  > **username_0**: For Update Existing Case I had Ongoing, Case Type I selected the specific case type, Case Status was set to Ongoing, for the Case Role section I had Case Client set to cid2, Case Creator set to automatic (although I am not opening a case with this activity) and Case Coordinator set to none.  I tried it lie that, then I tried it with Select None in the Case Roles section.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-09-25. Score: 2 | Accepted answer
  
  Looks like this was a bug in the comparison logic. See if this fix works for you:
  <https://github.com/colemanw/webform_civicrm/pull/17>
  
  > **Comments:**
  > **username_0**: Thanks username_2.  I'll check it out tonight or tomorrow when I get home from the User Summit!  
  > **username_0**: Your fix appears to do the trick!  Have I told you lately how awesome you guys are (aside from a few hours ago)?  
  > **username_2**: Cool, glad it works for you.  
  
  ---
  
  ### Answer by username_1 on 2015-09-22. Score: 0
  
  Not an answer per se, more a comment, but too long to fit in the comment box:
  
  For me this sounds like a bug. I've just checked the set-up I'm using for a very similar scenario, where I'm creating a new activity and filing it on a pre-existing case. Case processing is not enabled, and the activity is being created as I expect in the correct case, where I am passing in the case client id into a hidden field in the form.
  
  As you are specifying 'Test Case' as the case type for the 'File on Case' section then I would say there is no way that the activity should be getting filed anywhere other than in a Test Case, hence my assertion that there is a bug at work here. In my case I'm only working with one case type so I've not come across this issue.
  
  > **Comments:**
  > **username_0**: Thanks username_1, I experience the same issue on the development server.  
  > **username_0**: When the activity is filed on the wrong case, it seems to go to the highest case_id (or in other words, most recently opened case). Never does it appear to go to the lower numbered case.  
  > **username_1**: Which suggests to me that it isn't filtering for case type at all, despite what you've told it to do, and is simply going for the first case it can find based on the other criteria.  
  > **username_0**: I went to try a user select field for the Case Type and that isn't an option in the activities section.  I'm out of ideas.  
  
  ---
  
  