Display a dialog box info on login (showcase example in ACE KL May/2022)

This is a showcase example during Atlassian Community Event Kuala Lumpur in May 2022.

You can display a dialog box for once using ScriptRunner’s Show a web panel fragment. Hopefully, anyone find this useful:

Condition script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.UserPropertyManager
import com.opensymphony.module.propertyset.PropertySet

String newInfoTag = "May 2022 TOS Update"

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();

def userPropertyManager = ComponentAccessor.getOSGiComponentInstanceOfType(UserPropertyManager.class);
def userProperty = userPropertyManager.getPropertySet(user)?.getString("Last info box viewed");

if (userProperty != newInfoTag) {
    userPropertyManager.getPropertySet(user).setString("Last info box viewed", newInfoTag);
    return true
}

return false

Provider class/script:

writer.write("""
<body onload="showWelcome()">
<section id="demo-dialog" class="aui-dialog2 aui-dialog2-small aui-layer" data-aui-modal="true" role="dialog" aria-hidden="true">
<header class="aui-dialog2-header">
<h2 class="aui-dialog2-header-main">Updates to Paid Terms of Service</h2>
</header>

<div class="aui-dialog2-content">
<p class="aui-message aui-message-warning">
We’re updating our Paid Terms of Service (“Paid Terms”) to help clarify and make them easier to understand. The Paid Terms apply when you purchase content or services or pay for a subscription.
 
You can review a full summary of the changes and the updated <a href="https://notifications.google.com/g/p/AD-FnEwxdNmqtCdpP4-1Y8MlptmmFnSGobHjuiR62QhaGxvSEh3NJZ0Mx5VS-cgue_wtQgXEkos7yAwDjPI1CliOuORrKAzYs2_pZlnDfY-MfCD1zPY_ywAmbvf-I0Ws_fgzEcg">Paid Terms</a> here.
</p>
</div>
<footer class="aui-dialog2-footer">
<div class="aui-dialog2-footer-actions">
<button id="dialog-submit-button" class="aui-button aui-button-primary">Okay</button>
</div>
</footer>
</section>
</div>

<script>
var ci = document.getElementById("dialog-submit-button");

if (ci.addEventListener) ci.addEventListener("click", dialogClose, false);

function showWelcome() { 
    AJS.dialog2("#demo-dialog").show(); 
}

function dialogClose() { 
    AJS.dialog2("#demo-dialog").hide();
}
</script>
""")

This is the screenshot of the result:

can this code be used to show the dialog box on-hover of a custom field?

Sorry for the late reply. No, you can’t unfortunately.