Hi,
I'm trying to set a Text field to bold in a view screen.
Started with JS in Announcement Banner, it works but breaks UI in many places.
Here is the code:
<script type="text/javascript">
(function($){ jQuery(document).ready(function($){
document.getElementById("customfield_10700-val").style.fontWeight = "900";
document.getElementById("customfield_10700-val").style.fontWeight = "bold";
document.getElementById("customfield_10700-val").style.textTransform="uppercase"
$(function(){
});
}); })(jQuery);
(AJS.$);
</script>
I am now trying to find a new way to do this, in a post-function where I get the custom field text value:
def txtfield = customFieldManager.getCustomFieldObject(
"customfield_10700"
)
def txtfieldval = issue.getCustomFieldValue(txtfield)
Is there a way to manipulate formatting with Atlassian SDK/API?
I would need to set that Text Field renderer to 'Wiki Style Formatting' in Field Configuration, I'm just trying to find ways to manipulate those variables (Font size, font weight etc)
Many thanks
Solved it, if anyone needs it:
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.event.api.EventPublisher
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.fields.renderer.wiki.AtlassianWikiRenderer
import com.atlassian.jira.util.velocity.VelocityRequestContextFactory
// Get Custom Field Value
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def targetField = customFieldManager.getCustomFieldObject('customfield_10700')
def changeHolder = new DefaultIssueChangeHolder()
def rendererManager = com.atlassian.jira.component.ComponentAccessor.getComponent( com.atlassian.jira.issue.RendererManager.class)
def fieldLayoutItem = com.atlassian.jira.component.ComponentAccessor.getFieldLayoutManager().getFieldLayout(issue).getFieldLayoutItem("customfield_10700")
def renderer = rendererManager.getRendererForField(fieldLayoutItem)
String desc = renderer.renderAsText(issue.summary, null)
desc = ('h2.' + '*' + desc + '*')
targetField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(targetField), desc),changeHolder)
It copies value from summary into a text field, sets it as h2 and strong.
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.