Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner: get current url?

Manuel
Contributor
October 26, 2022

Hi,

I'm wondering how to get the current url that is shown in the browser? In Jira easy, but hwo can i do it in confluence?

 

I want to create a condition that only runs a script fragment when the user is in the space admin area > user rights.

 

Best Regards

 

Manuel

 

 

1 answer

1 vote
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 26, 2022

In my experience, the URL is not available for fragment conditions in Scriptrunner.

The only variable in the binding is DefaultWebInterfaceContext

But depending on what kind of fragment you are trying to implement, it might be available elsewhere.

For example, in a "Show Web Panel", in the Provider class/Script, you can access the URI with the following snippet:

import com.atlassian.confluence.core.ConfluenceActionSupport
def action = context.action as ConfluenceActionSupport
def uri = action.currentRequest?.requestURI as String ?: ""

 

Manuel
Contributor
November 3, 2022

Thanks, i will check if this will work for us. I will just show a small message box.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events