I have a groovy script in which I am dynamically creating subtasks based on some conditions. I want each of these subtasks to have a link to a confluence page automatically created, from a template(which I have already created). How do I do that? No other add-on than script runner is allowed. I have seen many such questions online, but none of them provide with a way to do it with scriptrunner and using a confluence template .
So, it sounds like you need to do two things when the sub-task is created:
1) Create a new page from a template in Confluence
There does appear to be a REST endpoint in Confluence's API that lets you create an instance of a template with a POST request. You can call it using the app link configuration; see the documentation on interacting with other Atlassian apps.
If Confluence's current REST endpoint doesn't cut it, you could use ScriptRunner for Confluence to add a scripted REST Endpoint that you can call from JIRA.
2) Link the sub-task to the newly created Confluence page
You could simply embed a JIRA macro in the new Confluence page. Assuming JIRA and Confluence are linked, this should create a remote link in JIRA as well. See the docs on interacting with confluence from JIRA.
You could also create the remote link inside JIRA using the Java API for it.
Bummer! Just to clarify, do you have ScriptRunner for Confluence, or just ScriptRunner for JIRA? Because if you've got SR for confluence, I believe you can create a page from a template via the Java API using the CreatePageFromTemplateAction class... don't have an example handy, but I can cook one up if SR for Conf is an option for you.
Confluence still hasn't exposed the Template feature to the REST API - This is probably why you don't see any documentation on this topic.
This leaves a few options –
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot