Hi,
Creating my first space template and I'm looking to minimize input fields and so I am looking to automatically populate the 'Requested by' field by the currentusername (registered name of the user creating that new document) AND the created date (today) when a user is creating a new document from that specific template.
Thx for your help
Hello there Gilbert!
You can surely achieve this with native tools from Confluence. However, we will need to dig a little into User Macros creation.
Let us start by taking a look here:
Now for us to achieve this result, we will need to:
1- Click the Cog Icon at the top right corner in Confluence
2- Select General Configuration
3- Search for User Macros in the left side bar
4- Enter User Macros
5- Click to Create a User Macro
Now that we are inside the creation, we can start creating the macro:
1- In the Macro name text field, insert a name for this macro. I used creator-macro, for the sake of simplicity
2- Select who can view this macro under Visibility
3- Write a Macro Title for this macro. Macro title is what is shown when you search for this macro
4- Under Definition of User Macro, look into Macro Body processing
5- Select No Macro Body
6- Now in the Template text field, insert this code for the macro## @noparams7- Save the macro
<div class="aui-message aui-message-info">
$content.getCreatorName()
$action.dateFormatter.formatGivenString("yyyy-MM-dd", $content.getCreationDate())
</div>
After saving, you can now create your template and insert this new macro into it. When someone uses the template, their name and content creation date should be displayed.
Let us know if this is what you are looking for!
edit: fixed the user macro
Hello @Diego
It seems the user @Gilbert Louis is using Confluence cloud, thus I don't think "User macros" are possible on the confluence cloud.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tarun Sapra, @Diego yes we are using confluence cloud.
I have access to the general configuration pages but can only see 'macro usage' option in that list on the left hand side.
I would be surprised that something as 'simple' as fetching the user name to auto-populate it in a user created template is not available in confluence cloud???
or same to fetch today's date to add to my template so I know when that page was created.
Thx
Gilbert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello there!
Thanks for pointing that out. I did not notice the tag for Confluence Cloud. I have synced with my Confluence Cloud colleagues about this request and currently, we can not achieve this in Confluence Cloud.
You can surely check this info under Three dots menu (..)>Page Information. A third-party solution does exist, but is only available for Confluence Server as well:
Page Info for ScriptRunner Confluence
Also, let me fix my user macro sent before. Currently, this would show the current user, not the creator. Fixed version is as follows:
## @noparams
<div class="aui-message aui-message-info">
$content.getCreatorName()
$action.dateFormatter.formatGivenString("yyyy-MM-dd", $content.getCreationDate())
</div>
Let us know your thoughts!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@DiegoMuch appreciate your time and effort to provide an answer... I will look at implementing in the morning and will let u know... :-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User macros aren't possible in Confluence Cloud, but you can create your own macros (and other functionality) as Confluence Connect apps. The simplest app to create could just be some templated wiki content, accessed as a custom macro (just like a user macro).
More here https://developer.atlassian.com/cloud/confluence/about-confluence-cloud/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello there @Gilbert Louis!
As pointed out earlier by Champions here, this solution is not available for Confluence Cloud. The solution provided took in consideration Confluence Server, which is not the correct environment. It may be a good idea to take a look into this article:
Functional differences in Confluence Cloud
You can still check this information under Three dots menu (..)>Page Information. There you should be able to check all those details.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.