The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Behaviours in cloud, question for organization users

Eduard Diez
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.
February 7, 2024

Hi!

We need a Behaviours JavaSctript script, which hides one of the organisations of ServiceManagement, so the members don't receive mails, when one of them create a ticket.

But I can't get the value of the organisations field to compare it.

If the organization is the 158, it should disappear


getFieldById("customfield_10002").setVisible(false);  // organization field

 

if( getFieldById("issuetype").setValue("10463")) {
    getFieldById("customfield_10002").setVisible(true);

} else{
        getFieldById("customfield_10002").getId("158").setVisible(false);
}

 

It doesn't work... Please could you help me community?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Eduard Diez
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.
February 9, 2024

Filally I put a script in the transition of the WF ServiceManagement that it put the participants and I forget the organization.

 

If the community need this script is there:

 

def issueKey= "XXX-111"
def issue
def result = get('/rest/api/2/issue/' + issueKey)
       .header('Content-Type', 'application/json')
       .asObject(Map)
if (result.status == 200){
         issue = result.body
} else {
      return "Failed to find issue: Status: ${result.status} ${result.body}"
}

def array = [
                 "accountIds1",
                 "accountIds2",
                 "accountIds3"
]

def accountIds = []

// Construir un array de objetos con el formato esperado
array.each { accountId ->
accountIds << [accountId: accountId]
}

def update = put("/rest/api/2/issue/${issueKey}")
         .queryString("overrideScreenSecurity", Boolean.TRUE)
         .header('Content-Type', 'application/json')
         .body([
                 fields: [
                         customfield_10119: accountIds
                               ]
                ] )
         .asString()

if (update.status != 204) {
return "${update.status}: ${update.body}"
}

return 'Success'

0 votes
Nic Brough -Adaptavist-
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.
February 7, 2024

Hi Eduard,

Behaviours can only manipulate the front-end of the system, it does not allow you to stop sending mail to someone based on what is entered on the screen.

Eduard Diez
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.
February 7, 2024

yes I know that, but, in this case what we do is that all the users are part of a specific organisation 158, and what we want is that the user cannot share the issue with anyone if it is not of the type 10463.

I don't know if I'm making myself clear, because when sharing it, it sends mails.

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events