Answers.Body: <p>Case seems like the good fit for the model, I'd suggest to keep it and create a civicrm extension that provides the UI you need. The integration with angular is fairly complete so loading/saving the activities from your UI should work fine.</p>
  
  <p>If you want to dig into angular for civi, <a href="https://london2015.civicrm.org/sessions/creating-dynamic-uis-civi-and-angular" rel="nofollow">Tim session</a> might help you getting started.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T17:34:15.847Z
Answers.Text: Thanks. Could you point me to any resources on how to develop that?
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T17:35:25.730Z
Answers.Text: Hmm, also, see edit - CiviCase wouldn't allow the nesting I need OOB
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T17:43:44.097Z
Answers.Text: why custom fields? mapping each objective to a case, or have an "objective" activity type for the goal case that contains the custom fields you need
Answers.UserDisplayName: Xavier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T21:25:23.680Z
Answers.Text: Ah yes I hadn't thought of objectives as activities but that would provide the required structure. I think this is probably the right solution although I will need to put a temporary one in place for the deadline and then tackle this.
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T17:26:02.097Z
Answers.LastActivityDate: 2016-01-21T17:49:08.067Z
Answers.LastEditDate: 2016-01-21T17:49:08.067Z
Answers.UserDisplayName: Xavier
Answers.Body: <p>we have done a slightly related solution where each student has to set a goal, then those get reviewed (but a determined number of times). The approach we took relied heavily on Views and Webform, with Activities being the 'holder' of the data. As our situation had a determined number of reviews we created all the fields required eg Review Comments, Rating, Date etc, in a Set of fields on the Activity - ie we had Review Comment 1, Rating 1, Date 1, and then also Review Comment 2, Rating 2, Date 2 etc.</p>
  
  <p>We then used Views to display lists of students with a link to 'Review' which would open webform with relevant cid and the 'open' Activity, so they could then add the next round of data to that Activity.</p>
  
  <p>I know this doesn't answer your core requirement, but if you need a light solution, and 'if' your maximum number of reviews isn't a ridiculous size, this might be worth considering.</p>
  
  <p>EDIT: in a comment below I also suggest using a single Activity per goal and report that to a single screen in Views</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T18:30:52.410Z
Answers.Text: oh yes ours is part of civicase but doesn't 'need' to be for the above to work.
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T21:32:00.950Z
Answers.Text: Thanks. I think I will use something like this as a temporary solution (although I will put the custom fields on the contact directly and not bother with the webform or view). But ultimately it is required that the number of objectives be variable.
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T21:55:11.073Z
Answers.Text: Other option would be to have an Activity per review. Hence each review adds a new Activity. Then you just need a way of reporting all those on a single screen. For Drupal, Views is your friend.
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-22T07:20:54.453Z
Answers.Text: Yes I think I will go with activity per objective (review in your case) but a drupal view won't be enough I'm afraid, since the desired ui has to support editing (unless `editable views` works with `civicrm entity`? Maybe that's worth a try)
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-22T22:02:38.020Z
Answers.Text: Editable views? not as far as i recall. so a table with a list/summary of the Activities (goals) with a link to 'edit' which would open the Activity would not suffice?
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-24T17:54:38.013Z
Answers.Text: Possibly. Would need a different interface for editing the activity though, as the standard one would have too much extraneous stuff
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T18:30:04.817Z
Answers.LastActivityDate: 2016-01-21T22:17:53.237Z
Answers.LastEditDate: 2016-01-21T22:17:53.237Z
Answers.UserDisplayName: petednz - fuzion
Body: <p>Please could I have some suggestions on how to meet this requirement:</p>
  
  <p>I need to be able to add a support plan to a contact. The support plan has an indeterminate number of goals. Each goal has a type, a description and also an indeterminate number of objectives, each of which has a type, a description and some dates. The whole support plan must be visible on the screen at one time, not just while viewing but also while editing.</p>
  
  <p>Civicase (mapping cases to goals) was my original thought but it does not fulfil the requirement of having it all on one screen. <em>EDIT</em> Also, I am not sure how I would record this data in CiviCase because a goal has to have an indeterminate number of objectives and it is not possible to create a repeating set of custom fields against a case. <em>/EDIT</em></p>
  
  <p>Custom fields, as they stand, do not provide what we need because although you can have repeating sets of fields, you cannot have repeating sets of fields within them.</p>
  
  <p>I am an experienced PHP coder and Drupal dev so taking a custom-code approach is within reach, however the project does not have a huge timescale so I would like to keep it to a minimum or avoid if at all possible.</p>
  
  <p>Here's what I've thought of so far:</p>
  
  <ol>
  <li><p>Submit a pull request to core, allowing for nested sets of custom fields (I think this would take a long time, both the coding and the administrative process).</p></li>
  <li><p>Use a Drupal page, so that I can utilise field collections. The problem with this though is that we would not be able to use CiviCRM reporting tools to report on the data. There would also be questions about how to link the drupal page to the contact (logically and visually).</p></li>
  </ol>
  
  <p>Any ideas? Thanks!</p>
  
Tags: <custom-fields><civicase>
Title: How to implement nested repeating fields?
ThreadText: # How to implement nested repeating fields?
  
  (Asked by: username_0 on 2016-01-21)
  
  Please could I have some suggestions on how to meet this requirement:
  
  I need to be able to add a support plan to a contact. The support plan has an indeterminate number of goals. Each goal has a type, a description and also an indeterminate number of objectives, each of which has a type, a description and some dates. The whole support plan must be visible on the screen at one time, not just while viewing but also while editing.
  
  Civicase (mapping cases to goals) was my original thought but it does not fulfil the requirement of having it all on one screen. *EDIT* Also, I am not sure how I would record this data in CiviCase because a goal has to have an indeterminate number of objectives and it is not possible to create a repeating set of custom fields against a case. */EDIT*
  
  Custom fields, as they stand, do not provide what we need because although you can have repeating sets of fields, you cannot have repeating sets of fields within them.
  
  I am an experienced PHP coder and Drupal dev so taking a custom-code approach is within reach, however the project does not have a huge timescale so I would like to keep it to a minimum or avoid if at all possible.
  
  Here's what I've thought of so far:
  
  1. Submit a pull request to core, allowing for nested sets of custom fields (I think this would take a long time, both the coding and the administrative process).
  2. Use a Drupal page, so that I can utilise field collections. The problem with this though is that we would not be able to use CiviCRM reporting tools to report on the data. There would also be questions about how to link the drupal page to the contact (logically and visually).
  
  Any ideas? Thanks!
  
  **Tags:** custom-fields, civicase
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-01-21. Score: 1 | Accepted answer
  
  Case seems like the good fit for the model, I'd suggest to keep it and create a civicrm extension that provides the UI you need. The integration with angular is fairly complete so loading/saving the activities from your UI should work fine.
  
  If you want to dig into angular for civi, [Tim session](https://london2015.civicrm.org/sessions/creating-dynamic-uis-civi-and-angular) might help you getting started.
  
  > **Comments:**
  > **username_0**: Thanks. Could you point me to any resources on how to develop that?  
  > **username_0**: Hmm, also, see edit - CiviCase wouldn't allow the nesting I need OOB  
  > **username_1**: why custom fields? mapping each objective to a case, or have an "objective" activity type for the goal case that contains the custom fields you need  
  > **username_0**: Ah yes I hadn't thought of objectives as activities but that would provide the required structure. I think this is probably the right solution although I will need to put a temporary one in place for the deadline and then tackle this.  
  
  ---
  
  ### Answer by username_2 on 2016-01-21. Score: 1
  
  we have done a slightly related solution where each student has to set a goal, then those get reviewed (but a determined number of times). The approach we took relied heavily on Views and Webform, with Activities being the 'holder' of the data. As our situation had a determined number of reviews we created all the fields required eg Review Comments, Rating, Date etc, in a Set of fields on the Activity - ie we had Review Comment 1, Rating 1, Date 1, and then also Review Comment 2, Rating 2, Date 2 etc.
  
  We then used Views to display lists of students with a link to 'Review' which would open webform with relevant cid and the 'open' Activity, so they could then add the next round of data to that Activity.
  
  I know this doesn't answer your core requirement, but if you need a light solution, and 'if' your maximum number of reviews isn't a ridiculous size, this might be worth considering.
  
  EDIT: in a comment below I also suggest using a single Activity per goal and report that to a single screen in Views
  
  > **Comments:**
  > **username_2**: oh yes ours is part of civicase but doesn't 'need' to be for the above to work.  
  > **username_0**: Thanks. I think I will use something like this as a temporary solution (although I will put the custom fields on the contact directly and not bother with the webform or view). But ultimately it is required that the number of objectives be variable.  
  > **username_2**: Other option would be to have an Activity per review. Hence each review adds a new Activity. Then you just need a way of reporting all those on a single screen. For Drupal, Views is your friend.  
  > **username_0**: Yes I think I will go with activity per objective (review in your case) but a drupal view won't be enough I'm afraid, since the desired ui has to support editing (unless `editable views` works with `civicrm entity`? Maybe that's worth a try)  
  > **username_2**: Editable views? not as far as i recall. so a table with a list/summary of the Activities (goals) with a link to 'edit' which would open the Activity would not suffice?  
  > **username_0**: Possibly. Would need a different interface for editing the activity though, as the standard one would have too much extraneous stuff  
  
  ---
  
  