It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Set value to the Page Template Variable in Confluence Edited

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

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

any workaround for this??

Can anyone help me to resolve this please..

Hi @Dario_Bonotto 

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

Kind Regards

Sushma

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

Cheers,
Dario

Like Sushma likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

283 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you