Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Confluence Banner with ScriptRunner

Hi all

In this little article, I want to show you, how I made a Confluence Banner with ScriptRunner with some additional features.

My goal was a confluence banner, which:

  • can be closeable for every user and doesn't show up for this user again
  • is time controlled
  • has to show only for a few user groups.

Yes, I know there are plugins for this, but with 2000 licences, theese are very expensiv and I'm a curious developer. So I did this to find out, can I do this with scriptrunner. 

What I did was a confluence page, a script fragment, a REST Endpoint and a user macro. The confluence page is for the tracking which user has closed the banner.

Before I deep dive, I want to tell you, that this is a dirty way to fulfill my goal, but so far it works quite well.

Script fragment (also see github documentation)
This is the most important thing. I made a script fragment with a condition. In the condition, I made some settings for time, group and whether this user has already read the news banner.

  • pageId
    • On this page I save the users, which clicked on the close button. The informations will be stored in a TextProperty.
  • dateFrom / dateTo
  • groupname

The provider script has the banner and javascript for calling the REST Endpoint.

REST Endpoint (also see github documentation)
The REST Endpoint saves the user which clicked the close button on the created confluence page in the TextProperty

User Macro (also see github documentation)
The user macro reads all the users which are on this page in the TextProperty.

Result

When a user closes the banner, the user macro (in the confluence page) will generate the following table containing the user-data.

image.png

So I can track who clicked away the banner and when.

My versions

  • ScriptRunner: 6.10.0
  • Confluence: 7.4.1

All of the Scripts are in my new github project: https://github.com/laschi23/confluence-banner 

I am very grateful for all and any feedback :) 

Regards, Dominic

6 comments

Hi Dominic,

sounds very interesting to me!

Where am I able to download the ZIP? I'm looking forward to give you some feedback then.

Cheers,
Thomas

Like # people like this
Dominic Lagger Community Leader Oct 12, 2020

Hi @Thomas Egger @Patrice Champet 

It seems that i can not upload a zip.
Therefore I uploaded the scripts to github.

https://github.com/laschi23/confluence-banner 

Hi Dominic,

This is awesome! I managed to use your code to get this working in my instance:

Screen Shot 2020-10-15 at 1.54.53 PM.png

I will share this with the rest of the ScriptRunner for Confluence team. We absolutely love to see all the unique ways that people are utilizing our app.

Regards,

Josh

Software Engineer, ScriptRunner for Confluence

Hi @Dominic Lagger,

I tested your script and it works perfectly.

  • Maybe you could improve the documentation so that it is clear for everybody which type of fragment (Custom web item, show a web panel, ...) to use and what to choose in the "Location" field.
  • It would also be helpful to state that the page id in the fragment is only for storage and is not responsible for showing the banner only on that page.
  • Have you already though of a version of your script for Jira?

Thanks a lot for sharing your work!

Cheers,
Thomas

Dominic Lagger Community Leader Oct 16, 2020

Hi @Thomas Egger 

Thank you very much for your feedback. 

On github, I changed the readme and also this article (reference to github). So it should be a little bit clearer. I also made some changes:

  • Change from StringProperty to TextProperty (StringProperty can only have 255 signs)
  • Add possibility for 3 groupnames, not only one

JIRA

I thought of a JIRA version, yes. But I didn't try it yet. But in my mind, this should be very easy. In JIRA you need the same fragment. The rest should be very similar, because closing the banner on JIRA could also call the REST Endpoint in Confluence. 

Regards, Dominic

Dominic Lagger Community Leader Oct 16, 2020

Hi @Joshua Yamdogo _ Adaptavist 

Thanks a lot for this awesome feedback! I'm very happy that it worked on your system!

Thanks for sharing it with your team :) ! 

Regards, Dominic

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Confluence

⚡️NEW Group for Confluence Cloud Admins

Calling all Confluence Cloud Admins!  We created a new Community Group to support your unique needs as Confluence admins. This is a group where you can ask questions, access resou...

181 views 3 11
Read article

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