I have a script derived from https://library.adaptavist.com/entity/send-custom-notification-to-slack, but for Microsoft Teams. Works fine when run in ScriptRunner console.
I want to use the script as a Post Function in a workflow that is used by many projects. I want to use a different url for each project, e.g. for an event in Jira project X the script posts to the url for Teams project X', and for an event in Jira project Y the script posts to the url for Teams project Y'.
I was hoping to use a per-project attribute to store the URL, and read it from the post function. But I see from https://community.atlassian.com/t5/Jira-Software-questions/custom-field-in-project-details/qaq-p/1182450 there are no project-level custom attributes. I could keep a table of project-to-url mappings in the script. Are there any good alternatives to doing that?
I'm new to Jira and ScriptRunner.
You could store the url in the description of each project using some html tag (so that the url doesn't show when viewing the project) and use some string manipulation or regular expression to extract the URL.
Or you could use the OfBizProperty system. But with that, you will need to use some scripting to store the url for each project (not very user-friendly unless you build a UI too).
def project = ComponentAccessor.projectManager.getProjectObjByKey('JSP')
//initialize the properties for a proeject
def properties = OFBizPropertyUtils.getCachingPropertySet('Project',project.id)
//store the property
//retreive a property
def url = properties.getString('msteamworks.url')
When to use CSV importer When managing your processes in Jira, there are many occasions where you need to create a lot of tasks. Creating them one by one will cost you a lot of time and effort and i...
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