Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Behaviour: setFormValue for Description in a JEditor-rendered-description field

Kevin Dekan
August 17, 2018

Hi there,

 

I am trying to create a behaviour, that on a create screen prefills the description-field with a template (preferrably html) in relation to the selection in a dropdown-field.

I.e.:

- when option A is chosen in the dropdown-field, template A should be loaded in the description-field (in the create screen, to be able to edit the description before creating the issue. In fact, this should be a checklist to input the required information before creating the issue). 

- when option B is chosen, template B should be loaded

 

I already achieved this in a description field with  the default text renderer, but this renderer cannot handle html. We normally use JEditor for our text fields, but it seems, the addon does not render the html-code when using this script, so it does not work with a JEditor-rendered-description-field.

 

Any ideas?

 

Thanks,

 

Kevin. 

 

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
June 29, 2021

Yes that is possible.

You have to decide how/when to send this information. It could be triggered by a workflow transition/post function, based on a Scripted Listener or a Job that runs on a schedule.

Then once you've decided that and have one or more issue object, you have to decide what attribute of the issue (and custom fields) you want to construct your JSON with. E.g:

import groovy.json.JsonBuilder
import com.atlassian.jira.component.ComponentAccessor
def cfm = ComponentAccessor.customFieldManager
def custFieldObject = cfm.getCustomFieldObjectsByName('custom field name')[0]
//assumes issue is declared and available
def newObject = [:]
newObject.issueKey = issue.key
newObject.assigneeEmail = issue.assignee.emailAddress
newObject.customField1 = issue.getCustomFieldValue(customFieldObject)
def jsonString = new JsonBuilder(newObject).toString()

Then you need to figure out how you want to connect to your third party app and make sure you can authenticate etc.

Or maybe your third party app is flexible, in which case, you might be better off using a WebHook from the jira side to send a standard payload.

TAGS
AUG Leaders

Atlassian Community Events