When a customer is not added to 'Request Participants' field in a issue, if the customer emails to an email notification of the issue. The reply will be added as an internal comment with the tag 'NO ACCESS TO REQUEST'.
If we want to change the comment property from internal to 'Share with Customer' with Scriptrunner script, the comment property updated successfully but the INTERNAL comment's tag still there and it doesn't share with customer.
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.bc.issue.comment.property.CommentPropertyService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.util.json.JSONObject
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.Issue
import org.apache.log4j.Logger
def logger = Logger.getLogger("Comment property change")
final SD_PUBLIC_COMMENT = "sd.public.comment"
def commentPropertyService = ComponentAccessor.getComponent(CommentPropertyService)
def commentManager = ComponentAccessor.getCommentManager()
def issueManager = ComponentAccessor.getIssueManager()
Issue issueObject = issueManager.getIssueObject("Temp-12345")
def comment = commentManager.getLastComment(issueObject)
ApplicationUser appUser = issueObject.getReporterUser()
def authorEmail = comment.getAuthorApplicationUser().getEmailAddress()
def commentBody = comment.getBody()
def commentProperty = commentPropertyService.getProperty(appUser, comment.id, SD_PUBLIC_COMMENT).getEntityProperty()
logger.debug ("Comment Property: ${commentProperty.get()}")
if (comment) {
def properties = [(SD_PUBLIC_COMMENT): new JSONObject(["internal", true])]
commentManager.update(comment, properties, true)
logger.debug("Update End")
}
Log output:
Property value before updating: key=sd.public.comment,value={"internal":true}
Property value before updating : key=sd.public.comment,value={} and internal property false
Comment does have has the Internal tag and the comment is not available in customer portal. Do you think it is a bug?
Thank you much for your thought and help.