# How do I change field's rendering method via script?

**URL:** <https://forum.library.adaptavist.com/t/how-do-i-change-fields-rendering-method-via-script/413>\
**Category:** ScriptRunner\
**Tags:** data-center, jira\
**Created:** [December 14, 2023, 4:37pm UTC](https://forum.library.adaptavist.com/t/how-do-i-change-fields-rendering-method-via-script/413 "2023-12-14T16:37:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![t0m1slav](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@t0m1slav](https://forum.library.adaptavist.com/u/t0m1slav)\
**Post date:** [December 14, 2023, 4:37pm UTC](https://forum.library.adaptavist.com/t/how-do-i-change-fields-rendering-method-via-script/413/1 "2023-12-14T16:37:12Z")

</div>

Hello,  
How do I change field’s rendering method via script?  
I tried everything, and there is not much examples for this.  
I have a field that is used in multiple field configurations. I’d like to change its rendering method in all field configurations.  
My JIRA DC version is 8.20.15.  
Thank you.

---

<div class="post-metadata">

**Author:** ![mdoar](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.library.adaptavist.com/mdoar/32/66_2.png) [@mdoar](https://forum.library.adaptavist.com/u/mdoar)\
**Post date:** [December 14, 2023, 7:59pm UTC](https://forum.library.adaptavist.com/t/how-do-i-change-fields-rendering-method-via-script/413/2 "2023-12-14T19:59:59Z")

</div>

I’ve done this before with a ScriptRunner script. Of course, test in a staging instance

```auto
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem

// Change the renderer for Log Work for all field configurations
// The script may time out after about 5 minutes but continues to run on the server. 
// Have to change the default field configuration by hand
// Renderers are provided by the templatehelper plugin

    
def dryRun = true

def fieldLayoutManager = ComponentAccessor.getFieldLayoutManager()
def result = new StringBuffer()

def fieldLayouts = fieldLayoutManager.getEditableFieldLayouts()
for (fieldLayout in fieldLayouts) {
    result.append("Field Configuration: " + fieldLayout.name)
    result.append("<br>")

    def fieldName = "worklog"
    def futureRenderer = "go-jira-renderer"
    def FieldLayoutItem fieldLayoutItem = fieldLayout.getFieldLayoutItem(fieldName)
    def rendererType = fieldLayoutItem.getRendererType()
    if (rendererType != futureRenderer) {
	result.append("- Changing the field ''" + fieldName + "'' renderer from " + rendererType + " to " + futureRenderer)
	result.append("<br>")
	if (!dryRun) {
	    fieldLayout.setRendererType(fieldLayoutItem, futureRenderer)
	    fieldLayoutManager.storeEditableFieldLayout(fieldLayout)
        }
    }

}

return result.toString()

```
