Return Storage Format for Forms for Confluence form, from an SP called using the SQL plugin
Asked by Mark Berry:

After upgrading from Confluence 5.1 to Confluence 5.8, one of our stored procedures stopped working. The SP (which we call from a Confluence page using the SQL plugin) returned wiki markup for a FormMail (now Forms for Confluence) form, to be rendered on a Confluence page, but this now renders errors indicating that the FormMail macros aren't recognised.

We've rewritten the stored procedure to return the page coded as storage format instead of wiki markup; after disabling XSS protection in the SQL plugin we got this to work just fine - but only on the page where we originally mocked up the form we used to grab the storage format code.

If we ever edit the page, or call the SP from a different page from the one where the form was created, the form stops working, displaying the error message "Caution! No validation is performed in preview mode. To validate your mail form, please save the page".

I can only guess that the UID in the storage format of a FormMail form somehow ties the use of that form to the page - indeed the specific version of the page - where the form was created.

This doesn't deliver a workable solution, so I'm hoping it's possible to adjust the storage format returned so that the form is no longer tied to the page where it was created. We tried taking out all the UIDs from the storage format, but that didn't work.

The storage format we're using, which returns a table followed by a FormMail form, is below.

Many thanks in advance for your help. :smile:

\<table\>\<tbody\>\<tr\>\<th\>\<p\>Title:\</p\>\</th\>\<td\>\<p\>\<strong\>Seminar: Moving Image Collection Development\</strong\>\</p\>\</td\>\</tr\>\<tr\>\<th\>\<p\>Details:\</p\>\</th\>\<td\>\<p\>This module explores the background and history of archaeology within museums and its influence on the modern discipline..\</p\>\</td\>\</tr\>\<tr\>\<th\>\<p\>Type:\</p\>\</th\>\<td\>\<p\> \</p\>\</td\>\</tr\>\<tr\>\<th\>\<p\>Offered by:\</p\>\</th\>\<td\>\<p\>University of Birmingham\</p\>\</td\>\</tr\>\<tr\>\<th\>\<p\>Venue:\</p\>\</th\>\<td\>\<p\>University of Birmingham\</p\>\</td\>\</tr\>\<tr\>\<th\>\<p\>Date:\</p\>\</th\>\<td\>\<p\>30-Sep-2015\</p\>\</td\>\</tr\>\<tr\>\<th\>\<p\>Booking contact:\</p\>\</th\>\<td\>\<p\>mark.berry@[nottingham.ac.uk](http://nottingham.ac.uk)\</p\>\</td\>\</tr\>\</tbody\>\</table\>\<p\>\</p\>\<p\> \</p\>\<ac:structured-macro ac:macro-id="4c454d02-cea0-427a-beea-58b24a24666e" ac:name="mail-form" ac:schema-version="1"\>\<ac:parameter ac:name="subject"\>Course Booking Request\</ac:parameter\>\<ac:parameter ac:name="generatedUUID"\>347e7328-426a-4f41-a79f-3529ee58ed3f\</ac:parameter\>\<ac:parameter ac:name="destination"\>mark.berry@[nottingham.ac.uk](http://nottingham.ac.uk)\</ac:parameter\>\<ac:rich-text-body\>\<p\>\<ac:structured-macro ac:macro-id="49a2e074-13d0-4cbc-8019-fdc913332c55" ac:name="hidden-field-macro" ac:schema-version="1"\>\<ac:parameter ac:name="name"\>Course Title\</ac:parameter\>\<ac:parameter ac:name="value"\>Seminar: Moving Image Collection Development\</ac:parameter\>\</ac:structured-macro\>\</p\>\<p\>\<ac:structured-macro ac:macro-id="fa06a1ae-c568-4de6-995a-245a768c8429" ac:name="hidden-field-macro" ac:schema-version="1"\>\<ac:parameter ac:name="name"\>Delivery Date\</ac:parameter\>\<ac:parameter ac:name="value"\>2015-09-30 09:00:00\</ac:parameter\>\</ac:structured-macro\>\</p\>\<p\>\<ac:structured-macro ac:macro-id="8075a6e9-e661-469e-9edb-44e863e58447" ac:name="hidden-field-macro" ac:schema-version="1"\>\<ac:parameter ac:name="name"\>Course ID\</ac:parameter\>\<ac:parameter ac:name="value"\>326\</ac:parameter\>\</ac:structured-macro\>\</p\>\<p\>\<ac:structured-macro ac:macro-id="66c5d901-4e86-4d63-90ed-f7e5918aaeea" ac:name="hidden-field-macro" ac:schema-version="1"\>\<ac:parameter ac:name="name"\>Delivery ID\</ac:parameter\>\<ac:parameter ac:name="value"\>326\</ac:parameter\>\</ac:structured-macro\>\</p\>\<p\>\<ac:structured-macro ac:macro-id="c8944ac0-7957-4f39-9e1c-a1bda348a803" ac:name="hidden-field-macro" ac:schema-version="1"\>\<ac:parameter ac:name="name"\>User Name\</ac:parameter\>\<ac:parameter ac:name="value"\>$user.fullName\</ac:parameter\>\</ac:structured-macro\>\</p\>\<p\>\<ac:structured-macro ac:macro-id="a91eb9da-adc4-4443-82a3-aaa6de30a0dc" ac:name="hidden-field-macro" ac:schema-version="1"\>\<ac:parameter ac:name="name"\>User Email\</ac:parameter\>\<ac:parameter ac:name="value"\>$user.email\</ac:parameter\>\</ac:structured-macro\>\</p\>\<p\>\<ac:structured-macro ac:macro-id="f7334b08-4407-40f1-9cf0-3b6eea9ede17" ac:name="mail-textarea" ac:schema-version="1"\>\<ac:parameter ac:name="labelText"\>Additional booking request/queries:\</ac:parameter\>\<ac:parameter ac:name="cssStyle"\>width: 375px; height: 200px; max-width: none; vertical-align:left\</ac:parameter\>\<ac:parameter ac:name="name"\>Additional requests and queries\</ac:parameter\>\<ac:parameter ac:name="rows"\>4\</ac:parameter\>\<ac:parameter ac:name="cols"\>32\</ac:parameter\>\<ac:parameter ac:name="value"\> \</ac:parameter\>\<ac:parameter ac:name="required"\>false\</ac:parameter\>\</ac:structured-macro\>\</p\>\<p\>\<ac:structured-macro ac:macro-id="8823d52a-b771-4b1f-a74d-224db403a39f" ac:name="mail-submit" ac:schema-version="1"\>\<ac:parameter ac:name="name"\>Send booking request\</ac:parameter\>\</ac:structured-macro\>\</p\>\<ac:structured-macro ac:macro-id="929fce52-6f2f-44fb-a12a-8025f642b5b4" ac:name="mail-success" ac:schema-version="1"\>\<ac:rich-text-body\>\<pre\>Your course booking request has been submitted\</pre\>\</ac:rich-text-body\>\</ac:structured-macro\>\</ac:rich-text-body\>\</ac:structured-macro\>'


Answers:
author: Bob Swift (personal)
body: This is the same question as [SQL-415](https://bobswift.atlassian.net/browse/SQL-415).


Tags: addon-com.adaptavist.confluence.formmailng