1 answer

  1.  
    1
    0
    -1

    From the incoming processor, is it possible to get the Tempo Java API to get an account and assigning to a custom field:

    import com.atlassian.jira.component.ComponentAccessor
    
    def exaPlugin = ComponentAccessor.pluginAccessor.getEnabledPlugin("com.tempoplugin.tempo-accounts")
    def exaCl = exaPlugin.getClassLoader()
    def essClass = exaCl.loadClass("com.tempoplugin.accounts.account.api.AccountService")
    def ess = ComponentAccessor.getOSGiComponentInstanceOfType(essClass)
    
    def projectId = issue.project?.id ?: nodeHelper.getProject(issue.projectKey).id
    
    def allAccountsForProject = ess.getAccountsByProject(projectId).get()
    
    //Other methods: getAccounts(boolean), getAccountId(java.lang.String), getAllAccounts(), getAccountById(int), getAccountByIds(java.util.Set).
    
    //This is an example where the field is set from a default CF
    //String accountName = replica.customFields."Account".value
    
    String accountName = "The Account"
    
    
    issue.customFields."Account".value = allAccountsForProject.find{acc -> acc.name == accountName}
      CommentAdd your comment...