# Adding form field outside of fields section

**URL:** <https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998>\
**Category:** Development\
**Created:** [August 29, 2023, 7:39am UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998 "2023-08-29T07:39:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuv](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/yuv/32/320_2.png) [@yuv](https://forum.communityhealthtoolkit.org/u/yuv)\
**Post date:** [August 29, 2023, 7:39am UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998/1 "2023-08-29T07:39:42Z")

</div>

How do I add a particular field which is input from user, but outside of regular `fields` field in document. Currently, all user inputs in CHT are captured inside the `fields` section in document. Some fields like `form`, `reported_date`, etc are written outside of `fields` field, however they are created by CHT. I need to have `lmp_date` field written outside of the `fields` form for our requriement. How can I achieve that ?

---

<div class="post-metadata">

**Author:** ![Jennifer\_Quesada](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/jennifer_quesada/32/553_2.png) [@Jennifer\_Quesada](https://forum.communityhealthtoolkit.org/u/Jennifer_Quesada)\
**Post date:** [August 29, 2023, 10:44am UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998/2 "2023-08-29T10:44:40Z")

</div>

Hi @yuv

I believe it’s not possible at the moment. I had a quick look in [the code](https://github.com/medic/cht-core/blob/427cccb764e79728ec3650c0c077eaed2824691b/webapp/src/ts/services/enketo.service.ts#L684), maybe @jkuester can correct me if I’m missing something.

Can you tell us more details about that requirement? Why it’s needed?

---

<div class="post-metadata">

**Author:** ![yuv](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/yuv/32/320_2.png) [@yuv](https://forum.communityhealthtoolkit.org/u/yuv)\
**Post date:** [August 29, 2023, 12:13pm UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998/3 "2023-08-29T12:13:16Z")

</div>

Hi @Jennifer_Quesada,

We create different Schedules using [start\_from](https://docs.communityhealthtoolkit.org/apps/reference/app-settings/schedules/#app_settingsjson-schedules) property to send reminders for SMS users. We already have 6 forms that contribute to these schedules and they all depend upon the field specified in `start_from` and since being created from sms, that fields is directly accessible inside doc.

Now, we are giving user(s) ability to register same form via webapp as well. And, even though users submit form via webapp, we need to create same schedules that we are creating for. Now, the field we are using in `start_from` is not directly available when we submit form(s) from webapp and I need that field to be exposed outside of `fields`, so that we can directly access from doc.

---

<div class="post-metadata">

**Author:** ![Jennifer\_Quesada](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/jennifer_quesada/32/553_2.png) [@Jennifer\_Quesada](https://forum.communityhealthtoolkit.org/u/Jennifer_Quesada)\
**Post date:** [August 29, 2023, 12:58pm UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998/4 "2023-08-29T12:58:57Z")

</div>

Thanks for the explanation. If I’m understanding correctly that’s a transition and I can see we’re using a library called object-path (scroll to [usage)](https://www.npmjs.com/package/object-path) to get the [start\_from here.](https://github.com/medic/cht-core/blob/427cccb764e79728ec3650c0c077eaed2824691b/shared-libs/transitions/src/lib/schedules.js#L101)

Have you tried defining the [start\_from](https://docs.communityhealthtoolkit.org/apps/reference/app-settings/schedules/#app_settingsjson-schedules) with dot notation? Like this:  
`"start_from": "fields.lmp_date"`  
Maybe it works.

---

<div class="post-metadata">

**Author:** ![jkuester](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/jkuester/32/806_2.png) [@jkuester](https://forum.communityhealthtoolkit.org/u/jkuester)\
**Post date:** [August 29, 2023, 1:23pm UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998/5 "2023-08-29T13:23:35Z")

</div>

Just to confirm what @Jennifer_Quesada has already said, I do not know of any way to set properties from a form outside of the `fields` object.

---

<div class="post-metadata">

**Author:** ![yuv](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/yuv/32/320_2.png) [@yuv](https://forum.communityhealthtoolkit.org/u/yuv)\
**Post date:** [August 30, 2023, 4:32am UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998/6 "2023-08-30T04:32:23Z")

</div>

Hi @jkuester , @Jennifer_Quesada , We’ve used dot notation in some other forms where required. However, for this case all of our existing forms only have the data coming in `lmp_date` and not in `fields.lmp_date`. So, even though we might be able to create schedules out of pregnancy form by using `fields.lmp_date`, we’d miss other 6 forms that also need to create the same schedules.

---

<div class="post-metadata">

**Author:** ![michael](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/michael/32/319_2.png) [@michael](https://forum.communityhealthtoolkit.org/u/michael)\
**Post date:** [August 31, 2023, 8:01pm UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998/7 "2023-08-31T20:01:39Z")

</div>

Trying to understand the scenario, @yuv can you confirm if my understandings are correct…

1. You want to set up [SMS schedules](https://docs.communityhealthtoolkit.org/apps/reference/app-settings/schedules/#app_settingsjson-schedules)
2. You want this schedule to be triggered by 7 different forms
3. Some of these 7 forms are SMS forms, some are App forms
4. All 7 forms have an `lmp_date` field, but they are found in different levels (the `lmp_date` field is nested in the `fields` property of app forms)
5. It _ **is possible** _ to trigger these schedules from _ **EITHER** _ SMS forms _ **OR** _ App forms; but…
6. It **is _not_ possible** to use the _ **same** _ schedule for both SMS forms AND App forms

So the no-dev workaround would be to duplicate the schedule and have one just use `lmp_date` and the other use `fields.lmp_date`. Correct?

I assume it is not possible to use conditional logic for the `start_from`, correct? (_for example, check for `lmp_date` and if you don’t find it, use `fields.lmp_date`_)

What about [extension libraries](https://docs.communityhealthtoolkit.org/core/releases/4.2.0/#extension-libraries), could you use those to either create `fields.lmp_date` on the SMS reports or an `lmp_date` at the root level on app form reports?

---

<div class="post-metadata">

**Author:** ![yuv](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/yuv/32/320_2.png) [@yuv](https://forum.communityhealthtoolkit.org/u/yuv)\
**Post date:** [September 20, 2023, 6:03pm UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998/8 "2023-09-20T18:03:57Z")

</div>

Hi @michael , your understanding of the scenario is right.

I am also hoping to use `extension-libs` and I’ll follow up any question related to extension libraries in separate question.

---

<div class="post-metadata">

**Author:** ![yuv](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/yuv/32/320_2.png) [@yuv](https://forum.communityhealthtoolkit.org/u/yuv)\
**Post date:** [October 18, 2023, 10:21pm UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998/9 "2023-10-18T22:21:13Z")

</div>

It was not possible with `extension-libs`. This problem here would be solved after [Allow schedule to start with multiple fields · Issue #8633 · medic/cht-core · GitHub](https://github.com/medic/cht-core/issues/8633) is released, most probably on CHT 4.5.0.

---

<div class="post-metadata">

**Author:** ![yuv](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/yuv/32/320_2.png) [@yuv](https://forum.communityhealthtoolkit.org/u/yuv)\
**Post date:** [November 20, 2023, 3:23pm UTC](https://forum.communityhealthtoolkit.org/t/adding-form-field-outside-of-fields-section/2998/10 "2023-11-20T15:23:59Z")

</div>

While adding form field outside of the fields section is not worked on, the underlying issue requiring this has been fixed by allowing additional parameter in start\_from. This is available in 4.5.0.
