1
0
-1

Hi,

I have a connection from Jira On-prime to Salesforce. There are 2 things:

  1. By default Exalate syncs Jira comments in chatter of salesforce, I want to sync as case comments 
  2. In Jira there are option of private/public comments, I want same behaviour with case comments in Salesforce.


Thanks,

Sonal

 

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hey,


      Here is the solution which you can put in Salesforce Incoming sync script:


      replica.addedComments.collect {
      
              comment ->
              def isPublish = "true"
              if (comment.internal) {
                  isPublish = "false"
              }
              def SFCommentId = ""
              def res2 = httpClient.http(
                      "POST",
                      "/services/data/v54.0/sobjects/CaseComment",
                      JsonOutput.toJson(["CommentBody": "[$ {
                                         comment.author.displayName
          } ] commented : $ {
              nodeHelper.stripHtml(comment.body)
          }
          " ,
          "ParentId" : " $ {
              entity.Id
          } ", "isPublished": " $ {
              isPublish
          } " ] ),
          null,
          null ) {
              req ,
              res2 ->
              if (res2.code == 201) {
      
                  SFCommentId = res2?.body?.id
              } else {
                  debug.error("error while creating comment:" + res2.code + " message:" + res2.body)
              }
          }
          if ( SFCommentId ) {
              def trace = new com.exalate.basic.domain.BasicNonPersistentTrace()
                      .setType(com.exalate.api.domain.twintrace.TraceType.COMMENT)
                      .setToSynchronize(true)
                      .setLocalId(SFCommentId as String)
                      .setRemoteId(comment.remoteId as String)
                      .setAction(com.exalate.api.domain.twintrace.TraceAction.NONE)
              traces.add(trace)
          }
      }
      
      

      Thanks,

      Sonal

        CommentAdd your comment...