How to: Adding default comments to a transition screen?

ChrisR April 1, 2020

I am trying to add a template to the comments field for select transitions, that can be edited by the user in the transition screen.

I have tried the following with no success:

I tried using Behaviours to set the comment field but it seemed like it could not locate the comment field.

I tried using the service desk template, but once again nothing showed up.

Maybe I am just over looking something?

Last Behaviour script I tried:

def commentDev = getFieldById("comment")

def defaultValue = """/**** CODING IMPACT STATEMENT ****/

(Content goes here)

/** END CODING IMPACT STATEMENT **/
""".replaceAll(/ /, '')

if (!underlyingIssue?.description) {
commentDev.setFormValue(defaultValue)
}

 

 

1 answer

1 vote
Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 2, 2020

Hi @ChrisR,

If you want to set template for comment field during particular transition you can set initializer script with below

def value = """/**** CODING IMPACT STATEMENT ****/

(Content goes here)

/** END CODING IMPACT STATEMENT **/
""".replaceAll(/ /, '')

if(getFieldScreen().name == "Transition screen name"){
getFieldById("comment").setFormValue(value)
}

Also you can map the respective workflow if you want. I verified the above script in my space 

additionally your script may fail because of the condition you added, that will add template to comment field only if issue's description is empty

 

Hope this helps

 

BR,

Leo

Suggest an answer

Log in or Sign up to answer