Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Set value to the Page Template Variable in Confluence

Sushma July 23, 2019

Hi All,

I am creating a page in confluence with User Template  using confluence REST END point.

In the Template I created one Template Variable called "$issuekey".

I want to pass jira issuekey value to the $issuekey".

Currently I am doing using the following line of  code 

NewParentPage.setBodyAsString(tamplateAsString.replaceAll("issuekey","${issue.key}"))

I am replacing the variable with issuekey value.

 

is there any way to set the variable value in confluence?

Also I tried with below code

def pageTemplate = pageTemplateManager.getPageTemplate(params.tamplateid as Long)
String tamplateAsString = pageTemplate.getContent()
String issuekey = params.key
List<Variable> tempvar = pageTemplateManager.getTemplateVariables(pageTemplate)
log.debug("Number of variables in template"+tempvar)
tempvar.each { t ->
t.setValue(issuekey)
log.debug("Value of variable before"+t.getValue().toString())
}

I am able to set the value with the above code.But unfortunately while creation of the page the value is displaying in the created page.

Please help to resolve this

4 answers

1 vote
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 16, 2019

Hi  @Sushma ,

Kindly notice that this is not the best place to get help on development related questions.

The right resources are the ones listed in: https://developer.atlassian.com/server/confluence/get-help/

Specifically:

 

Please go to above resources, search for already existing threads/requests on the same topics and in case of no luck start a new thread or open a new request. 

 

Cheers,
Dario

0 votes
Sushma August 21, 2019

Hi @Dario B 

I have raised a request in both community and service desk.Thanks for the information.

Kind Regards

Sushma

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2019

You are very welcome. You should be able to get assistance in there :) 

Cheers,
Dario

Like Sushma likes this
0 votes
Sushma August 1, 2019

Can anyone help me to resolve this please..

0 votes
Sushma July 30, 2019

any workaround for this??

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events