Notifications coming from Service Desk appear to use the project portal name as the 'from' address.
How can I retrieve this value in ScriptRunner?
You would need to use something like this:]
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.servicedesk.api.portal.Portal
import com.atlassian.servicedesk.api.portal.PortalService
def portalManager = ComponentAccessor.getOSGiComponentInstanceOfType(PortalService)
Portal targetPortalResult = portalManager.getPortalForProject(user, project).right()
targetPortalResult.getName()
Where user is an instance of ApplicationUser and project is an instance of Project.
Mind you, the user must have access rights to this portal, or else this will fail.
Cheers!
Dyelamos
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.