Forums

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

Scriptrunner Condtion to check user URL is homepage

AisM
Contributor
September 20, 2023

I have a Scriptrunner fragment, which is supposed to run when certain conditions are met. One of the condition is to check if user URL is the homepage . I have the below code, but for some reason it doesn't work. But it does work for the date logic alone, and not when combined with the user URL . Can anyone please validate if its right.

 

def webActionSupport = ComponentAccessor.getComponent(JiraWebActionSupport)
def requestURL = webActionSupport.getHttpRequest().getRequestURI()

def homepageURL = "my homepageURL"

//Logic defined at end of script

if ((requestURL == homepageURL) && (today>=start && today<=end)) {
log1.info("Success:")
return true
}
}
return false

 

1 answer

0 votes
AisM
Contributor
September 20, 2023 edited

@Antoine Berry  The requirement was like, we need to have a dialog pop up box at the time of maintenance. When the user logs in, the box must pop up. Also, the time when this must show up must be controlled from a service desk. 

We were able to actually achieve this. The dates for when the box shows up is done through two custom field vales "Start date & end date". 

But the problem I have is, the box shows up every time the page loads. More like a nuisance at this point. I want the pop up box to be limited to once per user in a day, or maybe ONLY at the log in page or something. 

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events