Troubleshooting with outgoing condition

Originally asked by Amy C on 25 March 2021 (original question)


Hello,

I have a troubleshooting on my Outgoing synchronization and I don’t understand why ?
I only want synchronization when the SupportTeam = MyGroup (Group picker)

My trigger : project = myProject and SupportTeam = “MyGroup”
My Outgoing :
I tried a lot of things :

if (!issue.customFields."SupportTeam".value == ["MyGroup"]){
    return
}
    replica.key            = issue.key
    replica.type           = issue.type 
    replica.assignee       = issue.assignee 

OR

if (issue.customFields."SupportTeam".value != ["MyGroup"]){
    return
}
    replica.key            = issue.key
    replica.type           = issue.type 
    replica.assignee       = issue.assignee 
  

The first sync doesn’t pass my outgoing so I don’t have the synchronization but the outgoing works when I already have a synchronization.

Why the first sync doesn’t work ?

An issue can go to SupportTeam:MyGroup but can be modify to another group. And I want to stop the synchronization.

Regards.

JIRA Service Desk Server 4.4.3
Exalate : 5.1.3-j8


Answer by Amy C on 25 March 2021

Hello,

Works with :

if (!issue.customFields."SupportTeam".value == ["MyGroup"] && firstSync){
    return;
// For the first sync use !issue == xxxx
}else if (issue.customFields."SupportTeam".value != ["MyGroup"] && !firstSync){
    return;
// For next sync use issue != xxxx
}else{
    replica.key            = issue.key
    replica.type           = issue.type 
    replica.assignee       = issue.assignee 

This code is very very sad… but it works

Regards


Answer by Amy C on 25 March 2021

Hello,

Doesn’t work with else:

if (!issue.customFields."SupportTeam".value == ["MyGroup"]){
    return
}else {
    replica.key            = issue.key
    replica.type           = issue.type 
    replica.assignee       = issue.assignee 
}

Regards.


Answer by Amy C on 25 March 2021

Hello,

Thanks for your answer.

SupportTeam is a Group Picker. I followed the documentation.

“Contains” doesn’t work.

The first Sync doesn’t work but if I comment my condition on the Outgoing : the issue sync this time. After if I set my condition. The sync works perfectly with this same issue and with this condition.

I have a trouble with the first sync.

Regards.


Answer by André Leroy-Beaulieu Castro on 25 March 2021

Hi Amy,

Thanks for raising this community question. To make sure that your trigger works accordingly, I would suggest trying it first in the Issue Search section of your Jira since it’s JQL and make sure that it is finding the issues that you expect it to find.

Besides that, if you want to return in the outgoing sync when the group picker field has that value, since it is a list, I would expect something like this to work:

if (!issue.customFields."SupportTeam".value.contains("MyGroup")) {
    return;
}

Also make sure that you are using the custom field name exactly as it is defined in your Jira, the code above will only work if the field is called SupportTeam (without a space).

Thanks,

André


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.