1
0
-1

Hi Team,

We have a scripted connection for project A and Project B in local instance and below are the example configuration.

Outgoing:

if (issue.project.key == "DAR" && issue.typeName == "Defect"){

replica.customFields."10806" = issue.customFields."10806" //Accoutable Team//OEM Accountable Team
} Incoming: if(replica.project.key == "DAR" && replica.type.name == "Defect") //sync A -> B
{
issue.projectKey = "OEM"

def issueTypeMapping = ["Defect" : "Acquired Product Defect"] issue.typeName = issueTypeMapping[replica.type?.name] ?: "Acquired Product Defect" if (issue.projectKey == "OEM") { def aTeam = replica."10134"?.value if ((aTeam != "Alexandra") && (aTeam != "Canyon")&&(aTeam != "Carroll") && (aTeam != "Carroll-Ref")&& (aTeam != "Melody")&& (aTeam != "Mystic")) { issue.customFields."17003"?.value = "Alexandra" } else{ issue.customFields."17003".value = replica.customFields."10134".value }}

We have Multi List type field and some values only matching in both sides, Need a functionality like if any of the not available values in project B field is selected in Project A while syncing A->B default value to be set.

Example

Project A ->Have “Alder” value

Project B → Not have “Alder” Value

If I synced A->B --->I have to set default value, if value is not present otherwise it will set the same value as A in B Project.

Regards,

Moogambigai G R

  1. Moogambigai G R

    Hi Team,


    Is there any update on above question?


    Regards,

    Moogambigai G R

CommentAdd your comment...

2 answers

  1.  
    1
    0
    -1

    Hi Moogambigai, As mentioned in the support ticket after testing the following script and confirming that it works properly I am posting the solution here as well in case other members of our community encounter similar issues.


    Outgoing sync:

    if(issue.project == "ProjectKey"){
        replica."Affected Programs 2" = issue."Affected Programs 1"
    }else{
        replica."Affected Programs 1" = issue."Affected Programs 2"
    } 


    Incoming sync:

    Option 1:
    
    if(replica.project.key == "ProjectKey1"){
        def defaultOption =  nodeHelper.getOptions(issue, "Affected Programs 2", ["DefaultValue"])
        def options =  nodeHelper.getOptions(issue, "Affected Programs 2", replica."Affected Programs 2".collect { it -> it.value }).findAll { it != null}    if(options == null || options.size() == 0) {
            issue.customFields."Affected Programs 2".value = defaultOption
        } else {
            issue.customFields."Affected Programs 2".value = options
        }
    }
    if(replica.project.key == "ProjectKey2"){
        def defaultOption =  nodeHelper.getOptions(issue, "Affected Programs 1", ["DefaultValue"])
        def options =  nodeHelper.getOptions(issue, "Affected Programs 1", replica."Affected Programs 1".collect { it -> it.value }).findAll { it != null}    if(options == null || options.size() == 0) {
            issue.customFields."Affected Programs 1".value = defaultOption
        } else {
            issue.customFields."Affected Programs 1".value = options
        }
    }
    
    Option 2:
    
    if(replica.project.key == "ProjectKey1"){
        def defaultOption =  nodeHelper.getOptions(issue, "Affected Programs 2", ["DefaultValue"])
     
        issue.customFields."Affected Programs 2".value =  nodeHelper.getOptions(issue, "Affected Programs 2", replica."Affected Programs 2".collect { it -> it.value }).findAll { it != null} ?: defaultOption
    }
    if(replica.project.key == "ProjectKey2"){
        def defaultOption =  nodeHelper.getOptions(issue, "Affected Programs 1", ["DefaultValue"])
     
        issue.customFields."Affected Programs 1".value =  nodeHelper.getOptions(issue, "Affected Programs 1", replica."Affected Programs 1".collect { it -> it.value }).findAll { it != null} ?: defaultOption
    } 


    Kind regards.
    Ezequiel

      CommentAdd your comment...
    1.  
      1
      0
      -1

      Hi Moogambigai G R ,

      Could you please try the getOption method, and let me know if it does not comply with your requirement?

      Thank you,

      Ashar

      1. Moogambigai G R

        Hi M. Ashar Iqbal 


        I have tried with getoption, its throwing error and its a multi select type field.

        Requirement is if the values matches both side, it should sync that value, if not default values should sync.


        Attached support zip. exalate_support_5.3.1-j8_8.20.6_20220711-025716.zip


        Regards,

        Moogambigai



      2. Moogambigai G R

        Hi Ashar,


        Is there any update?


        Regards,

        Moogambigai

      3. Moogambigai G R

        Hi Ashar,


        Is there any update on my above comment?


        Regards,

        Moogambigai

      4. Ariel Aguilar

        Hi Moogambigai,

        You can try something like in the following example:

        issue.customFields."A".value = replica.customFields."B".value ?: "Default Value"

        Kind regards,

        Ariel

      5. Moogambigai G R

        Hi Ariel Aguilar 


        Thanks for the update. Please find below are the results i'm getting,


        Local connection:

        outgoing:

        replica.customFields."10134" = issue.customFields."10134" //Affected Programs // OEM Affected Programs

        Incoming:

          issue.customFields."17401".value = replica.customFields."10134".value ?: "Alexandra"


        10134 -Project A multiselect type field

        17401 -Project B multiselect type field


        Scenario 1:

        Same values available in both side:

        Here I have selected "carroll,canayon" in 10134 field and synced the record and  values are synced perfectly


        Scenario 2:

        One value has available in both side, one non-value selected:

        Selected Brilliance,Carroll in 10134 field and synced the record, its emptied the field in destination records and not setting default value as "Alxendra"


        Scenario 3:

        Non-matched values selected:

        Selected Brilliance in 10134 field and synced the record, its emptied the field in destination records and not setting default value as "Alxendra"

      6. Moogambigai G R

        Hi Ariel Aguilar 


        Is there any update on my last comment?


        Regards,

        Moogambigai

      7. Ariel Aguilar

        Hi there,

        If you try:

        issue.customFields."17401".value = replica.customFields."10134".value ?: ["Alexandra"]

        Kind regards,

        Ariel

      8. Moogambigai G R

        Hi Ariel Aguilar 


        Thanks for the update, I have tried above method, still no luck.


        Both side same values is there only its sync, if values didn't match its cleared the existing value  and not setting default value.


        See the below history images both local and remote issues.




        Regards,

        Moogambigai




      9. Moogambigai G R

        Hi Ariel Aguilar 


        Is there any update on my last comment?


        Regards,

        Moogambigai

      10. Ariel Aguilar

        Hi there,

        And if you do:

        issue.customFields."17401".value = replica.customFields."10134"?.value ?: ["Alexandra"]

        Kind regards,

        Ariel

      11. Moogambigai G R

        Hi Ariel Aguilar 


        I have tried below one also and tried to replaced the field name instead of custom id. Nothing working.


        issue.customFields."17401".value = replica.customFields."10134"?.value ?: ["Alexandra"]


        Regards,

        Moogambigai

      12. Ariel Aguilar

        This is not expected, if you try the following:

        def defaultOption =  nodeHelper.getOptions(issue, "17401L", ["Alexandra"])
        
        issue.customFields."17401".value = replica.customFields."10134"?.value ?: defaultOption

        Kind regards,

        Ariel

      13. Moogambigai G R

        Hi Ariel Aguilar 


        I have tried above method also, but result is same, if values is not matched in local side, its not setting default value, its setting null.


        If its possible, can we setup a meeting to resolve this issue.


        Regards,

        Moogambigai G R

      14. Ariel Aguilar

        Hi Moogambigai,

        Please submit a support request to our Service Desk directly to investigate for a possible bug. 

        Or just send an e-mail to support@exalate.com. This will create an issue on our JIRA Service Desk allowing for further tracking.

        Kind regards,

        Ariel

      CommentAdd your comment...