Confiforms - How to smart link parent and child tables
Asked by London:

The user enters data on form 1

IFTTT then creates a page - on that new page is form 2

On Page 2/Form 2, the user enters more data that is related to the data that had been collected in form 1

**Page 1/Form 1**

Name: "Mark"

Test Number: "5"

---- User Submits Record, and a new page is created called "Mark Test 5"

**Page 2 (Title: Mark Test 5)/Form 2**

Name: (Prefilled and unchangeable "Mark")

Test Number: (Prefilled and unchangeable "5")

Test Color: "Blue"

Table View:

**Name Test Number Test Details**

Mark 5 Blue

Mark 5 Red

Is a form inside an IFTTT that creates a new page considered a nested form? (I read somewhere those don't work).

I don't know how to connect form 1 and form 2 (I assume with smart fields - I just don't understand how?)


Answers:
author: Alex Medved _ConfiForms_
body: Hi

This seems to be the same question you have asked in <https://community.atlassian.com/t5/Confluence-questions/Confiforms-Action-that-creates-page-and-copies-some-data-between/qaq-p/2182538> and I have tried to answer

Nested forms, as you describe them, are supported. There is really nothing "nested" - just a form that creates another form, as I understand.

Nested forms, as we describe the, are the ones that are put inside each other, basically when you attempt to put ConfiForms Registrations Control FormView within another ConfiForms Registrations Control FormView macro

Have a [look at this page](https://wiki.vertuna.com/display/CONFIFORMS/Master+Detail+forms+or+how+to+show+data+from+2+forms+which+are+referenced+using+ConfiForms+smart+fields) to understand how ConfiForms smart fields are working and what is possible

Alex

comments: author: London
body: I think i finally got them to connect - but how do I make it not a drop down? I don't want to user to be able to change that value.


author: Alex Medved _ConfiForms_
body: Not sure why there is a requirement like that, but...

You can set up edit restrictions on this field or have rules that set it readonly or validate for change, so no one can change those.

<https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules>


author: London
body: It's set up that way because the hierarchy is:

Main Record 1 -- \> Sub Record 1 (...Sub Record n) --\> Detail of Sub Record 1 (...n)

I think I got the Parent -\> Child pages working...

But I can't seem to get Parent -\> Child -\> Child working.

**Page 1/Form 1**

Name: "Mark"

Test Number: "5"

---- User Submits Record, and a new page is created called "Mark Test 5"

**Page 2 (Title: Mark Test 5)/Form 2**

Name: (Prefilled and unchangeable "Mark")

Test Number: (Prefilled and unchangeable "5")

Test Color: "Blue"

---User Submits Record, and a new page is created called "Mark Test 5 Blue"

**Page 3 (Title: Mark Test 5 Blue)/Form 3**

How do I pull the record over correctly to be able to use it in Page 3/Form 3?


author: Alex Medved _ConfiForms_
body: Still confused by this requirement, but do you have a Confluence storage format editor installed? I can share an example of what I have came up with... as close as I understand this

```
<ac:structured-macro ac:macro-id="537b2c98-176e-4546-a96f-00ba903f031e" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">form1</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="718e2b0d-2df2-429e-8488-45b9edc59744" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">name</ac:parameter>
<ac:parameter ac:name="fieldLabel">name</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="716c4c11-7e58-4b94-93e6-2ef62c876499" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">testNumber</ac:parameter>
<ac:parameter ac:name="fieldLabel">Test number</ac:parameter>
<ac:parameter ac:name="type">number</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="a383d56d-0036-495c-9796-f8d6c4cf33f0" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">createdPage</ac:parameter>
<ac:parameter ac:name="fieldLabel">createdPage</ac:parameter>
<ac:parameter ac:name="type">hidden</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="a308f2d3-0aa4-4a60-8076-2ff7197d127e" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="51a59ba6-9c10-40ef-a735-cb809a85d0dd" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Create Page</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">[entry.name] Test [entry.testNumber]</ac:parameter>
<ac:parameter ac:name="resultName">cp</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="ae4ec9b2-1615-46b8-aed3-e1eee5bbb9f8" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="pageTitle">
<ac:link/>
</ac:parameter>
<ac:parameter ac:name="formName">form2</ac:parameter>
<ac:parameter ac:name="presetValues">name=[entry.id]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="117c7e95-9643-418a-8c5f-f4e0ec9eb901" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="filter">id:[entry.id]</ac:parameter>
<ac:parameter ac:name="pageTitle">
<ac:link/>
</ac:parameter>
<ac:parameter ac:name="formName">form1</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="7979efd2-f3f7-4a34-af15-1a4c64af94b8" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">entryId=[entry.id]&amp;createdPage=[iftttResult_cp.id]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="b9ca29b4-c7dd-4705-afd8-9ee62b99341c" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">form2</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="22ae4b51-0d74-4320-a333-e4d3f62e57e8" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">name</ac:parameter>
<ac:parameter ac:name="fieldLabel">Name</ac:parameter>
<ac:parameter ac:name="values">[119603488|form1|name|true||]</ac:parameter>
<ac:parameter ac:name="type">smartselect</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="2a5bcfc4-cc3a-446b-91bf-bd70f9fd9541" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">color</ac:parameter>
<ac:parameter ac:name="fieldLabel">Color</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="83650de3-3ff3-4105-b2d7-759e5a97183a" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">!name:[empty]</ac:parameter>
<ac:parameter ac:name="fieldName">name</ac:parameter>
<ac:parameter ac:name="action">Set field readonly</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="c50525cf-ef45-45a9-9cdb-45e99468cf4f" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Create Page</ac:parameter>
<ac:parameter ac:name="extras">[entry.name.createdPage]</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">[entry.name.name] Test [entry.name.testNumber] [entry.color]</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="e7d127d5-2f6f-4df4-9008-fc8d28f4c82c" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="pageTitle">
<ac:link/>
</ac:parameter>
<ac:parameter ac:name="formName">form3</ac:parameter>
<ac:parameter ac:name="presetValues">colorRef=[entry.id]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="c5fe49b9-65cc-4334-9cba-822ab957e9cd" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="filter">id:[entry.id]</ac:parameter>
<ac:parameter ac:name="pageTitle">
<ac:link/>
</ac:parameter>
<ac:parameter ac:name="formName">form2</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="06a5a682-67e6-43a4-a4c8-d6a984952162" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">form3</ac:parameter>
<ac:rich-text-body>
<p>
<ac:structured-macro ac:macro-id="d5a17712-4106-4d68-9d0b-7ba525696c74" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">colorRef</ac:parameter>
<ac:parameter ac:name="fieldLabel">ColorRef</ac:parameter>
<ac:parameter ac:name="values">[119603488|form2|color|true||[entry.name.name] [entry.name.testNumber] - [entry.color]]</ac:parameter>
<ac:parameter ac:name="type">smartselect</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="7f213633-e6fc-4a26-9e7b-26cbd07ff02f" ac:name="children" ac:schema-version="2">
<ac:parameter ac:name="all">true</ac:parameter>
</ac:structured-macro>
</p>
```

You will need to change the 119603488 to match your page ID where the forms are

Alex


author: London
body: Thank you! this helps a lot! Unfortunately I do not have access to storage format.

I still can't seem to get page 3 to become a child of page 2 (And now I have added a 4th and final page).

What is:

```
<ac:structured-macro ac:macro-id="7f213633-e6fc-4a26-9e7b-26cbd07ff02f" ac:name="children" ac:schema-version="2">
<ac:parameter ac:name="all">true</ac:parameter>
</ac:structured-macro>?
```

That's the only macro I couldn't figure out - and maybe that's why I cant connect the pages.


author: Alex Medved _ConfiForms_
body: This is just a <https://confluence.atlassian.com/doc/children-display-macro-139501.html> macro

Sad you dont have a storage format macro... this would have simplified things dramatically

The configuration I have shared creates a child page of a page 2 - see Create Page IFTTT that has the "extras" parameter (which is parent page parameter)

```
<ac:parameter ac:name="action">Create Page</ac:parameter>
<ac:parameter ac:name="extras">[entry.name.createdPage]</ac:parameter>
```


author: Alex Medved _ConfiForms_
body: Will add a quick video - <http://recordit.co/CuHxrHFiq3>

Hope it helps a bit better to understand the provided configuration (knowing you dont have a Source editor at your disposal)


author: London
body: Thank you! I will give this a try asap and let you know!


author: London
body: Could you show me how to make form 3 create a form/page 4?

I was able to follow your video and get that working - but I think I'm missing the logic/pattern when trying to have form 3 create a new page for form 4 (And then one last time for form/page 5)


author: Alex Medved _ConfiForms_
body: This is literally the same way as the page 3 is created... Absolutely the same concept of setting/saving the created page ID back to the record and then using it's value in the "Parent page" parameter of the IFTTT


Tags: confiforms

confluence-server

server