title: (Jira) Script Runner getCustomFieldValue ( get value without the html element)
body: <p>I want to get the value of a custom Jira field using the Groovy Script Runner. But when I run the following script in the Script Runner:</p>
  
  <pre><code>import com.atlassian.jira.ComponentManager
  import com.atlassian.jira.issue.CustomFieldManager
  import com.atlassian.jira.issue.fields.CustomField
  
  ComponentManager componentManager = ComponentManager.getInstance()
  CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()
  CustomField cf= customFieldManager.getCustomFieldObject("customfield_10301") 
  issue = componentManager.getIssueManager().getIssueObject("PM-72")
  
  def value = issue.getCustomFieldValue(cf)
  </code></pre>
  
  <p>the result is:</p>
  
  <pre><code>&lt;img src="/images/icons/priority_critical.gif"/&gt; High
  </code></pre>
  
  <p>How do I get just the <code>High</code> without the html <code>&lt;img&gt;</code> element?</p>
  
  <hr>
  
  <p><strong>UPDATE:</strong> with help from @doelleri, I figured out that changing the last line in the script to this will work:</p>
  
  <pre><code>def value =  issue.getCustomFieldValue(cf).getValue().tokenize().last()
  </code></pre>
  
  <p>...but that certainly feels like a hack. Isn't there some built-in method to accomplish this? For example, if this weren't a custom field (like "Priority" for example), the code would be:</p>
  
  <pre><code>def value =  issue.getPriority().getString("name");
  </code></pre>
  
  <p>is there something comparable for custom fields?</p>