Interact with Description field content

Philippe Beltran May 5, 2021

Hi

I would like that description field content is adjusted based on the checkbox, radio button selection using behavioursdescription field.pngcheckboxes.png in scriptrunner.

All this should happen before Issue is created (using Raise a request).

I've searched and tested many codes but the field remains empty, whatever I tried to code.

Thanks for your help

2 answers

1 accepted

0 votes
Answer accepted
Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2021

Hey @Philippe Beltran ,

Without knowing the code you've already tried I think you should be able to continue based on your previous behaviors.

In the API quick reference there is specific example for the description field.

https://docs.adaptavist.com/sr4js/latest/features/behaviours/api-quick-reference

 

First you need to ge the field of course:

def cfDescription = getFieldByName("Description")

but then you can set it like any other normal text field.

cfDescription.setFormValue("the text you want to set")
Philippe Beltran May 5, 2021

Hi @Dirk Ronsmans 

I just tested that, unfortunately Description field remains empty.

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2021

Any chance you could post the exact code you are using? 

I'd be happy to try and reproduce it.

Philippe Beltran May 5, 2021

Hi @Dirk Ronsmans 

Here is the simplified code I use to perform test:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.issue.customfields.option.Option
def list1Field = getFieldById(getFieldChanged())
def list1FieldValue = list1Field.getValue()
def cfDescription = getFieldByName("Description")

if (list1FieldValue == "App 4")
{
cfDescription.setFormValue("the text you want to set")
}

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2021

Did some testing myself and seems it isn't willing to work with the getFieldByName

In my test this works:

def cfDescription = getFieldById("description")
cfDescription.setFormValue("TEST THIS IS THE TEST!")

be sure to keep the "id" case-sensitve :)

Philippe Beltran May 5, 2021

Hi

I already tested and it doesn't work

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2021

That's weird. I have this code in front of me and just tested it and it works.

Do make sure the description is in lowercase.

Is the If clause triggering? If you move it outside of the If does it work then?

Philippe Beltran May 5, 2021

Hi

No still nothing. I replaced description with summary (as it is also a system field). there it works perfect.

It's only the description field which is causing trouble.

Philippe Beltran May 5, 2021

Can it be due to any setting on our Jira?

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2021

Really strange.

  • Do you see anything in your developer console of your browser? 
  • Or in the jira logs themselves? 

 

Since the code seems to work fine on my test instance I'm  puzzled as to why it wouldn't on your system. Not like it's the most complicated code ever..

If nothing shows up you might have to see if anybody else has a clue, or open a ticket with Adaptavist (https://productsupport.adaptavist.com/servicedesk/customer/user/login?destination=portals) 

Perhaps something specific to your app version is making it bug out?

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2021

Only setting I could think of would be some permissions on the fields but if you can change it manually the behaviour should be able to as well.

Philippe Beltran May 5, 2021

Hi @Dirk Ronsmans 

When I check the field using webtool on chrome I see that textbox is a textbox keyboard focusable but description field have other settings. Not sure if that can be the problem (see screenshots)description 1.pngdescription 2.pngdescription 3.pngsummary.png

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2021

well it will be different as it is a system field and also a multiline instead of a single line.

Do you see anything in the Console tab? 

You can open up the console first, then check the box and see if anything pops up as warning/error..

Philippe Beltran May 5, 2021

Nothing is pops up when I check the box

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2021

Well my bag of tricks is empty :)

I'd suggest opening a ticket now and see if something changed with your version or if a bug snuck in..

On my test system the code works fine so I don't see anymore what we can change

Philippe Beltran May 5, 2021

Hi @Dirk Ronsmans 

Thank you very much for your support (even we were unable to fix the problem).

I will raise a ticket with Adaptavist

Philippe

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2021

I'm sorry I'm not able to get you to a working solution.

If they come back with a reason why it's not working I'd love to know what the culrpit was!

Philippe Beltran May 5, 2021

For sure I will inform you if we find what is causing the problem.

Jamie Echlin _ScriptRunner - The Adaptavist Group_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 6, 2021

Thank you @Dirk Ronsmans for helping, those are definitely the correct trouble-shooting steps.

The other thing to check is that you have definitely created a mapping between your behaviour and is the project/issue type(s) , or service desk/request type(s) it should apply to.

I think you may be creating a ticket with us - great.

Something else to check is I believe there are plugins that can replace the standard wiki text area that Jira provides with a custom one. In addition, there are entire themes that replace the service desk portal which we can't support due to the nature of this functionality.

So let us know if you are doing this in the portal view, or if either of those other things apply.

cheers, jamie

Philippe Beltran May 6, 2021

Hi @Jamie Echlin _ScriptRunner - The Adaptavist Group_ 

The mapping is done and working as when I made test with Summary field instead Description field it works.

I checked in the plugins and did not see any pointing to wiki text.

Philippe

Jamie Echlin _ScriptRunner - The Adaptavist Group_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 6, 2021

I can see that this is in the JSM portal view.

I believe this is not working with the new AtlasKit editor that came in the most recent version of JSM. Did you raise a support ticket? If you did can you reference this thread, and we will get this fixed. I'll create a public bug ticket. 

Philippe Beltran May 6, 2021

Ticket created: PRODSUP-2468

Katy Kelly
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 Leaders.
May 7, 2021

Hi Philippe,

This appears to be caused by the bug we have listed here: https://productsupport.adaptavist.com/browse/SRJIRA-5076

We have linked it to this ticket and added you as a watcher so you'll be automatically notified as soon as it's fixed and released. This will most likely be in the next release that goes out.

If you have follow-up questions or issues to report please let us know through the ScriptRunner for Jira support portal

Kind regards,

Katy

Adaptavist Product Support 

0 votes
Ravi Sagar _Sparxsys_
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 Leaders.
May 5, 2021

Hi @Philippe Beltran 

What is your Jira and ScriptRunner version?

Ravi

Philippe Beltran May 5, 2021

Hi @Ravi Sagar _Sparxsys_ 

We have the following:

Jira v8.16.0
Scriptrunner Version: 6.23.0

 

Kind regards

Suggest an answer

Log in or Sign up to answer