How to add or modify data using the Run macro (without a user form)

This article explains how to create a form to insert or update data in the database using the Run macro.


  1. Install the following apps in your Confluence instance:
    1. Run Self-Service Reports
    2. SQL for Confluence (Pro Edition)
  2. Follow this link to configure the data source profile for SQL for Confluence app.


  1. Log into Confluence.

  2. Navigate to the existing page and click  to edit the page or create a new page.
  3. Insert Wiki Markup macro and as an example, you can paste the code given below:

    {run:titleRun=DATA Display|anchor=result}
              {run:id=update|replace=choice:Add::radio::Add::Update,id:1:Id (for update):integer-select:1:1000,type:dog:Select DB:select::MYSQL_new user:MYSQL_new          user:Mysql_confluence:Mysql_confluence,hand1:default:operational_hand_off_status:text,hand2:default:project_status:text,hand3:default:Resource Type:text|titleRun=Add|autoRun=true|anchor=result|focus=choice}
                INSERT INTO report (Project_status,Resource_type,operational_hand_off_status)VALUES('$hand2','$hand3','$hand1');
                *Row Updated*
                UPDATE report set Project_status = '$hand2', Resource_type ='$hand3',operational_hand_off_status = '$hand1' where report_id = $id
                *Row Added*
                h3. Results
                {sql-query:dataSource=MYSQL_new user}
                select report_id,Project_status,Resource_type,operational_hand_off_status from report
  4. Click Insert, and then Save. The macro is displayed on the page as follows:

  5. Select the choice field; Add inserts a new record and Update edits the record.
  6. Enter data in the required fields and click Add to save.

Data is added or updated in the database. As per the example mentioned above, the result is displayed as shown:

  • Test the function in a non-production environment before deploying it on production.