Storing and Retrieving Attachments, Pages, or Users

With the Set Data macro, Scaffolding can store links to attachments, pages or users. It can also store read-only text, as an alternative to text-data, if you do not require your users to edit forms.

Let's store an attachment, page and a sample user, and then retrieve that a link to those items with Get Data.

Ingredients

Add-ons

Scaffolding

Platform

Server, Data Center

Macros
Suppliers

Guide


Let's create four Set Data macros: one to store a link to an attachment, one to store a link to a page, one to store a link to a user and another to store text.

  1. Create a Set Data macro.
     
  2. Name it "storeAttachment" and change the Type to "attachment".

  3. Now attach a file to the page.
    For this example, we've uploaded a file called "example.jpg".

  4. Within the macro, type "^" and the name of the file, in this case "^example.jpg".

  5. Create another Set Data macro.
     
  6. Name it "storePage" and change the Type to "content".

  7. Within the macro, type a page name.
    In this example, we've used "SCAF:User Guide", which is the parent page for this tutorial.

  8. Create another Set Data macro.

  9. Name it "storeUser" and change the Type to "user".

  10. Within the macro, type a username from your Confluence instance.
    In this example, we've used the author's username.

  11. Create the last Set Data macro.
     
  12. Name it "storeText" and leave the Type to its default, which is "text".

  13. Within the macro, type some text.

  14. You should now have a set of four Set Data macros that should look something like this:


     
  15. Now let's retrieve the data that was stored in those Set Data macros.
    Create a Get Data macro.

  16. For the Field Name, type in the name of whatever Set Data macro you created above, depending on what data you want to retrieve.
    So for example, if you want to retrieve the link to the attachment, you would enter "storeAttachment" for Field Name of this Get Data macro.
    So for all four examples, you should end up with something like the following image:

     

 


Notes

Make sure there are no blank/white spaces before or after the written link.

Result

Data Storing

Store link of an attachment:

example.jpg

Store link of a page:

User Guide

Store link of a user: 

Ted Mahsun

Store text:

This is some text

Data Retrieval

Attachment LinkPage LinkUserText

This is some text