Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

Sync affectsversion from Servicenow to Jira

 
1
0
-1

Servicenow outgoing :

replica.u_product_version = entity.u_product_version


Jira Incoming :

issue.affectedVersions = replica
  .u_product_version
  .collect { v -> nodeHelper.getVersion(v.name, project) }
  .findAll{it != null}


note : wherein product version is a select list field type.

  1. Serhiy Onyshchenko

    Hey, Rajeswari T 

    What does an error print if you add this in front of your snippet and sync an issue towards it? 

    debug.error("u_product_version=${replica.u_product_version} type=${replica.u_product_version.class}")

    Regards, Serhiy

  2. Rajeswari T

    No such property: name for class: java.lang.string

  3. Serhiy Onyshchenko

    Hey, Rajeswari T , please comment out your other snippet:

    //issue.affectedVersions = replica
    //  .u_product_version
    //  .collect { v -> nodeHelper.getVersion(v.name, project) }
    //  .findAll{it != null}

    Regards, Serhiy

  4. Rajeswari T
    u_product_version=9.0.0.0type=class: java.lang.string
  5. Serhiy Onyshchenko

    So now you know the type and the value of the `replica.u_product_version` field, thus, you may

    remove the debug.error line and replace the commented

    //issue.affectedVersions = replica
    //  .u_product_version
    //  .collect { v -> nodeHelper.getVersion(v.name, project) }
    //  .findAll{it != null}


    do:

    issue.affectedVersions += nodeHelper.getVersion(
      replica.u_product_version, 
      project
    )


    Let me know, how it goes, Regards, Serhiy.

  6. Rajeswari T

    Serhiy Onyshchenko Same error again :

    No Such Property: Project for class: Script 299 

  7. Rajeswari T

    Serhiy Onyshchenko  -  i tried to replicate the same product verison to another version picker custom field called "Identified in Release". But it doesn't seem to be working


    Servicenow outgoing : 

    replica.u_product_version = entity.u_product_version


    Jira incoming :

    issue.customFields."Identified in Release".value = nodeHelper.getVersion(
      replica.u_product_version, 
      issue.project ?: nodeHelper.getProject(issue.projectKey)
    )
  8. Serhiy Onyshchenko

    Hey, Rajeswari T 
    Isn't Version picker custom field a multi-value custom field?
    In that case I'd suggest to do

    issue.customFields."Identified in Release".value = (issue.customFields."Identified in Release".value ?: []) 
    issue.customFields."Identified in Release".value += nodeHelper.getVersion(
      replica.u_product_version, 
      issue.project ?: nodeHelper.getProject(issue.projectKey)
    )

    Or, considering  

    short-hand-syntax-for-custom-fields
    issue."Identified in Release" // same as `issue.customFields."Identified in Release".value`
    issue."Identified in Release" = (issue."Identified in Release" ?: []) 
    issue."Identified in Release" += nodeHelper.getVersion(
      replica.u_product_version, 
      issue.project ?: nodeHelper.getProject(issue.projectKey)
    )

    Regards, Serhiy.

CommentAdd your comment...

1 answer

  1.  
    1
    0
    -1

    Please, try

    issue.affectedVersions += nodeHelper.getVersion(
      replica.u_product_version, 
      issue.project ?: nodeHelper.getProject(issue.projectKey)
    )
    1. Rajeswari T

      It works. Thanks a lot

    CommentAdd your comment...