Custom drop down list for Statuses
Asked by Thomas Hardin:

I would like to create a custom drop down list that provides users with a particualr status of a work request. We have several pre-defined statuses that a work request will go through from inception until completion.

The status macro isn't very helpful since you have to edit, select a color and add text. so, my thought is to use a table field where I could insert a cool drop down list with button type indicators with preset text. Example: when a work request has been submitted by a customer, the status is, EDS1. When it goes into tech review, it is changed to REVW. wen it goes into construction, it goes into WORK.

So I'd like to be able to change the status, or have a user change the status when necessary. And to add some flash, I'd like to each one have a color coded button of sorts.

Any ideas? I thought the use of buttons would make things easy since there are so many button generators out there.


Answers:
author: Davin Studer
body: You could create a user macro that has a parameter with a predefined set of values that would then populate a status macro's text and color depending upon which value is selected in the user macro parameter.

comments: author: Thomas Hardin
body: As a very new and very green user, is there an easy to follow path to doing this? I've seen a lot of html samples, so my guess is to modify those and then implement them into the macro?


author: Davin Studer
body: Here is an example of a user macro. These must be created by a system admin.

**Macro Name:**   
work-request-status

**Macro Title:**   
Work Request Status

**Macro Body Processing:**   
No macro body

**Template:**

```
## Developed by: Davin Studer
## Date created: 03/19/2014

## @param Status:title=Status|type=enum|required=true|enumValues=EDS1,REVW,WORK|desc=Choose a status.

#if ( $paramStatus == "EDS1" )
    #set ( $color = "Yellow" )
#elseif ( $paramStatus == "REVW" )
    #set ( $color = "Blue" )
#elseif ( $paramStatus == "WORK" )
    #set ( $color = "Green" )
#else
    #set ( $color = "Yellow" )
#end

<ac:macro ac:name="status">
    <ac:parameter ac:name="colour">$color</ac:parameter>
    <ac:parameter ac:name="title">$paramStatus</ac:parameter>
</ac:macro>
```


author: Thomas Hardin
body: Thank you very much Davin! You've been a big help.


author: Thomas Hardin
body: So, for each status type, I can continue to add colors. Could I use a CSS class instead of the color?


author: Davin Studer
body: This example uses the built in status maco ... which only has five colors. If you need more than that you would need to build out your own status indicator with html. You could use css. In the user macro if you replace the macro xml with html and add in a \<style\> block you could make it look the way you want. I just figured I would show it to you with the status macro as it is built into the system and would thus follow the system's UI guidlines. User macro's are super handy. They give you the ability to do some somewhat powerful things without having to drop down to programming a full on plugin in Java.


author: Per L?fgren (Qlik)
body: Thanks David! This was exactly what I was looking for but I couldnt get it to work at first. All that was wrong though was that it needed a space in the beginning of the macro when defining the parameter. Probably just a formatting error when doing a copy paste to the editor

```
## @param Status:title=Status
```


author: Axel Holene
body: The suggested approach does indeed work, but you still have to first edit the page and then edit the status macro to change status. As far as I am concerned, this is no real "drop down status list".

Is it possible to achieve a proper drop down status list without having to buy add-ons? I'm on a customers system, and can't go installing add-ons as it suits me.


author: Florian Z?llner _Communardo_
body: I'd go with an Marketplace Add-on solution. You could either use the [Comala Workflows Add-on](https://marketplace.atlassian.com/plugins/com.comalatech.workflow/server/overview) for review processes of pages or simple use the [Metadata for Confluence Add-on](https://marketplace.atlassian.com/plugins/com.communardo.confluence.metadata/server/overview) to add custom (e.g. dropdown) fields to pages.

Of cause you can get a filtered list of all pages with xyz-status with both tools.


author: Andrey Khaneev _StiltSoft_
body: [Handy Status](https://docs.stiltsoft.com/display/HMFC/How+to+use+Handy+Status+macro) macro ([Handy Macros](https://marketplace.atlassian.com/plugins/com.stiltsoft.confluence.handy.macros/server/overview) add-on) does exactly what you want.


author: Thomas Hardin
body: As a very new and very green user, is there an easy to follow path to doing this? I've seen a lot of html samples, so my guess is to modify those and then implement them into the macro?

comments: author: d h
body: I just came across this post and this is what I did... version 5.8.10.

Log into Confluence as an Admin.

Click on the gear at the top and click on Geneeral Configuration.

In the left menu box, click on User Macros -\> Create a New User Macro.

```
Macro Name:   work-request-statusVisibility: Visible to all users in the Macro BrowserMacro Title: Test Case StatusDescription: Test Case Status for reporting.Categories: Confluence ContentMacro Body Processing:  UnrenderedTemplate:## Developed by: Me## Date created: 2016-04-07## @param Status:title=Status|type=enum|required=true|enumValues=NOT STARTED,IN PROGRESS,PASS,FAIL,BLOCKED|desc=Test Case Status.#if ( $paramStatus == "NOT STARTED" )#set ( $color = "Grey" )#elseif ( $paramStatus == "IN PROGRESS" )#set ( $color = "Yellow" )#elseif ( $paramStatus == "PASS" )#set ( $color = "Green" )#elseif ( $paramStatus == "FAIL" )#set ( $color = "Red" )#elseif ( $paramStatus == "BLOCKED" )#set ( $color = "Red" )#else#set ( $color = "Grey" )#end<ac:macro ac:name="status">    <ac:parameter ac:name="colour">$color</ac:parameter>    <ac:parameter ac:name="title">$paramStatus</ac:parameter></ac:macro>
```

Then save. After saving, you can go create a new page and insert macro.


author: Jennifer Iwata
body: I've used this in the past and it's worked, but I'm on a new instance and getting this error: "Error occurred rendering template content"

Any thoughts on how to resolve the error?


author: Davin Studer
body: If you used the above code as-is from "d h" then that is why. When Atlassian migrated their content off the old Answers site to this new site almost all of the code snippets got borked. You need to replace \&lt; with \< and \&gt; with \>.


author: Davin Studer
body: I've fixed the above code to remove the escaped xml characters.


author: tifonas-katrina
body: Great job, guys!

Noobies thank you! :)


Tags: css

list

menu

select-list