Page tree
Skip to end of metadata
Go to start of metadata

This is the documentation for ConfiForms Server/Data Center app


Quite often we are asked about the possibility to have a page with ConfiForms Form that creates sub-pages with another ConfiForms form or forms, having some smart fields which need to be dynamically pointed at the field in the form used to create this sub-page.

This is easy to do, right? You just create something like 


Having an "outer" form and an inner form, with a field "d" of type smart dropdown pointing at form "f", field "t" values

You save the page and can create sub-pages like this, and the data in the smart dropdown is nicely loaded

But if you copy the original page with Confluence, the reference in "d" field in inner form will still be pointing at the page you have copied this from.

Could we make this dynamic? yes, we can!

ConfiForms evaluates the IFTTT macro body as a Velocity template. See Configuring ConfiForms IFTTT actions and has a number of objects in the context

context.put("entry", entry); <- ConfiForms Entry (raw)
context.put("user", user); <- Confluence user object
context.put("page", contentObject); <- AbstractPage object (Page or BlogPost rich object, any getter can be accessed)


which you can reference as any other variable in Velocity using velocity syntax


Which means we can use reference to current page using 

${page.id}

We can access parent page of the current page if necessary and so on...

${page.parent.id}

quite easy... when you know... 


Confluence editor does not allow us to put something like this into the parameters....

So, we need to have a way to alter storage format a bit, and this is where Confluence editor plugin helps us, https://marketplace.atlassian.com/plugins/com.atlassian.confluence.plugins.editor.confluence-source-editor/server/overview. It is a free plugin from Atlassin, which helps to do the "fine tuning".

So, with this plugin we could go to page internals, find the smart field and do something like this.

Change

to


Save the page and that's it - you have a dynamic "inner" form. So, when you copy your  page with "outer" form and create new records and pages there you will have the reference in your smart field set dynamically to point at the right "owning page"



  • No labels