Questions for Confluence license has expired.

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

Sprint Sync only when sprint name contains text

 
1
0
-1

I want to write an IF statement to test a text field value ... but I don't want to use equal (==) or not equal (!=) ... I want to see if the text field contains a specific piece of text ... how do I do that?

For example ... I want to sync sprints from a board ... but only sprints which names contain the text 'MDDUS'

def boardIds = ["240"] //Boards which sprints will get synced
if(entityType == "sprint" && boardIds.find{it == sprint.originBoardId}){
    if (sprint.name!="MDDUS") return
    replica.name = sprint.name
    replica.goal = sprint.goal
    replica.state = sprint.state
    replica.startDate = sprint.startDate
    replica.endDate = sprint.endDate
    replica.originBoardId = sprint.originBoardId
}
    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi there,

      If you want to make your script to return whenever the sprint name does not contain "MDDUS", you can do the following:

      if (entityType == "sprint" && boardIds.find { it == sprint.originBoardId }) {
          if (!sprint.name.contains("MDDUS")) return
          replica.name = sprint.name
          replica.goal = sprint.goal
          replica.state = sprint.state
          replica.startDate = sprint.startDate
          replica.endDate = sprint.endDate
          replica.originBoardId = sprint.originBoardId
      }

      Thanks,

      Ariel

        CommentAdd your comment...