Want to achieve the same through script runner behaviour, but not happening:
Trying below code :
const descField = getFieldById("description");
// Get existing value
const currentValue = descField.getValue();
// Only set if description is empty
if (!currentValue || !currentValue.content || currentValue.content.length === 0) {
descField.setValue({
version: 1,
type: "doc",
content: [
{
type: "table",
content: [
{
type: "tableRow",
content: [
{
type: "tableHeader",
content: [
{
type: "paragraph",
content: [{ type: "text", text: "Field" }]
}
]
},
{
type: "tableHeader",
content: [
{
type: "paragraph",
content: [{ type: "text", text: "Details" }]
}
]
}
]
},
{
type: "tableRow",
content: [
{
type: "tableCell",
content: [
{
type: "paragraph",
content: [{ type: "text", text: "" }]
}
]
},
{
type: "tableCell",
content: [
{
type: "paragraph",
content: [{ type: "text", text: "" }]
}
]
}
]
}
]
}
]
});
}
Hi @Alok Deo
See this example
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
// 1. Get the Description field
def descField = getFieldById("description")
// 2. Define your table using Wiki Markup
// || = Header Cell, | = Normal Cell
def tableTemplate = """
|| Header 1 || Header 2 || Header 3 ||
| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 |
| Row 2 Col 1 | Row 2 Col 2 | Row 2 Col 3 |
""".stripIndent()
// 3. Set the value only if the field is empty (to avoid overwriting user input)
if (!descField.getValue()) {
descField.setFormValue(tableTemplate)
}
Hi,
Can you elaborate what is not working ?
You can use this ADF builder to create the content you want and past it into behaviour
Document builder
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.