1
0
-1

Hello! I'm new to writing Groovy and looking for assistance in writing some script in preventing attachments over 35MB from being able to sync bidirectionally from Salesforce to ADO/Jira. We receive a Bad Gateway Error that makes our Console completely inaccessible when a large attachment sync amongst one of our connections. Any guidance is appreciated.  

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi!

      this is the way I filter outgoing attachments on the Salesforce side towards Jira, I hope it's useful to you!

      def remoteAttachments = entity.attachments.findAll { attachment ->
               replica.filename = attachment.filename
               String fileName= attachment.getFilename()
               replica.estensione = fileName
      attachment
      }
       
      //The max size of the attachments in bytes. 1MB = 1.000.000 bytes
      def maxFileSize = 300000000
      def refacturedList = []
      for(file in remoteAttachments){
          if(file.filesize <= maxFileSize){
              refacturedList.add(file)
          }
      }
      replica.attachments = refacturedList


        CommentAdd your comment...