Confluence RUN / CLI / SQL: Pass generated variables to each other

Hi,

It's complicated to explain, to put it short, I want to:

Get user generated values with RUN, get a result from a DB query with these, use that result and the other values with CLI. Problem is, I don't know how to "store" the result of the query for further usage in CLI.

Long version:

I'm currently building a user input mask for creating new projects using the run & cli-plugins in combination with the sql plugin.

Setup:

Run-Form asks for customer key and some other data, upon "run" an sql query gets the customer name from another database. Thats works.

Then I'm using CLI to add the space, space key is the customer key, space title should be the customer name that is fetched from the external database, but I can't get that working.

If I directly enter the sql query macro as a value for the space title in the CLI command, the spaces title will be {sql-query}myquery{sql-query}.

When I execute the query before the CLI-macro I get the value, but I have no idea how to get that result of my sql-query passed onto the cli macro.

I also tried nested runs with a replace-value = my sql query, but that totally messes up the macro.

Any help is appreciated!

1 answer

1 accepted

0 votes
Accepted answer

I would usually go to a little scripting for complex cases, you can gets some hints from How to generate choice values using SQL . In some cases you can get away with replace and render type logic to like How to generate choice values using replace and render . If you need more help, I would need more time to look at all the details - open a support issue.

Thanks Bob, I will give that a try. If I dont get this working, is it possible to change the space title with cli? I could create the space and rename it later then. Haven't found any option to update a space...

Just gave it a try (never used replace and render before), it worked instantly. Thanks a lot!!

There is not a remote API to update the space title or description :(. The CLI would have to use some other techniques to provide that. Open an issue if it is important.

Thanks for your feedback. As I managed to set the space title upon creation now I don't need to rename. But one last question - is it possible to define the space homepage with CLI 2.5? I first create the space, then copy some pages and then I want to set one of these pages as the space homepage.

I think that came in a later release at least that is what the doc archive 2.5.0 indicates.

Might be helpful for others:

Solved by saving my new homepage with the same title as the old home page with replace paramater :)

Bob, in general: A big thanks for your great plugins!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,177 views 20 14
Join discussion

Atlassian User Groups

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!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you