Custom Confluence user macro not working

Kim Van Slooten January 24, 2019

I have created 2 custom user macros, one works and the other does not. It gives the error of Unknown macro. I would appreciate any help with figuring out the issue.

Below is the user macro that works:

## @Param Status:title=StatusColor|type=enum|enumValues=New Request,In Progress,Completed|required=true|desc=Choose a status.

#if ( $paramStatus == "New Request" )
#set ( $paramColor = "Yellow" )
#elseif ( $paramStatus == "In Progress" )
#set ( $paramColor = "Blue" )
#elseif ( $paramStatus == "Completed" )
#set ( $paramColor = "Green" )
#else
#set ( $paramColor = "Yellow" )
#end

<ac:structured-macro ac:name="status">
<ac:parameter ac:name="color">$paramColor</ac:parameter>
<ac:parameter ac:name="title">$paramStatus</ac:parameter>
</ac:macro>

Below is the user macro that is throwing the error:

## @Param Urgency:title=UrgencyColor|type=enum|enumValues=High,Medium,Low|required=true|desc=Choose an urgency.

#if ( $paramUrgency == "High" )
#set ( $paramColor = "Red" )
#elseif ( $paramUrgency == "Medium" )
#set ( $paramColor = "Orange" )
#elseif ( $paramUrgency == "Low" )
#set ( $paramColor = "Yellow" )
#else
#set ( $paramColor = "Yellow" )
#end

<ac:structured-macro ac:name="urgency">
<ac:parameter ac:name="color">$paramColor</ac:parameter>
<ac:parameter ac:name="title">$paramUrgency</ac:parameter>
</ac:macro>

1 answer

1 accepted

0 votes
Answer accepted
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 25, 2019

OK, I am going to ask a stupid question. What is the urgency macro? I am aware of the status macro. I am guessing you need to change

<ac:structured-macro ac:name="urgency">

to

<ac:structured-macro ac:name="status">

Also, take a look at my recent article. You may get some new ideas, mainly on avoid the if-elseif tree. Also, it specifically involves the status macro. It is located here: Getting Started with User Macros - Writing a Wrapper Macro

Kim Van Slooten January 28, 2019

Not a stupid question at all. My first attempt at writing a macro by copying another. Thanks for pointing me the right direction. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events