Behaviour doesn't work "on change"

Ilia Mamontov May 16, 2023

Hello, im trying to add link via behaviours of scriptrunner (first part of address) to my custom field after user adding value with ticket number (last part of address), but it works only "on load" when im creating ticket, it automatically adding first part of address to my custom field, any idea why it doesn't work "on change"? Screenshot 2023-05-17 at 14.30.20.png

2 answers

1 accepted

0 votes
Answer accepted
Alex Koxaras _Relational_
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 17, 2023

@Ilia Mamontov hi and welcome to the community,

Where is this field located and first filled in? In the portal from the customer?

In addition you have placed a behavior on customfield_10038 and you try to change its behavior when you will change its value?

Alex Koxaras _Relational_
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 17, 2023

@Ilia Mamontov in addition, SR on cloud only work on create screen:

 Please note that Behaviours inside of ScriptRunner for Jira Cloud use the UI Modifications API in order to modify Jira's issue create screen.

Using your script I confirm that everything works (almost) as expected during creation screen. And the script I used was:

const link = "https://google.com/"
const currentData = getFieldById("customfield_10042").getValue()
getFieldById("customfield_10042").setValue(link+currentData)

 

Like Ilia Mamontov likes this
Ilia Mamontov May 17, 2023

Im trying to make this script for link creating for new and existing issues in my jira cloud, users will add only ticket number in this field, it should be automatically transformed into link with this number in the end, for example user adding ticket number 555, behaviour should convert it to the link: https://freshdesk.com/tickets/555

but now it works only for new tickets, and it creates only link without number, as i understand behaviour should work only after someone adding any value, not before.

Alex Koxaras _Relational_
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 17, 2023

@Ilia Mamontov as I said on my previous comment: Behaviors cloud works only on create screen. So you shouldn't have any problem with your script during issue creation.

For existing issues, behaviors can't do much. I would assume that:

  • you have to create a global self transition (any status to any status)
  • On that global transition place a post function (scriptrunner if you have it, but my cup of coffee is JMWE) with which you will change the value of that field to "link+currentData"
  • Bulk transition all existing issue you want via advanced issue search
Like Ilia Mamontov likes this
Ilia Mamontov May 17, 2023

@Alex Koxaras _Relational_ oh, i miss this information about cloud behaviour works only on create screen, thanks, i will try another option!

0 votes
Karim ABO HASHISH
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 17, 2023

hi @Ilia Mamontov 

Welcome to the community.

Could you please try with .setFormValue instead of setValue function.

Let me know how it went for you.

Cheers,

Karim

Alex Koxaras _Relational_
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 17, 2023

@Karim ABO HASHISH setFormValue is only for SR server. On cloud you have only setValue:

sr setvalue.png

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events