Send comments to Zendesk only if certain text is found in ADO comment eg: @send2Zendesk if found in comments section only then will it sync to zendesk

Originally asked by Sarita Bhatt on 11 October 2023 (original question)


How do i send comments to Zendesk only if certain text is found in ADO comment eg: @send2Zendesk if found in comments section only then will it sync to zendesk


Answer by Javier Pozuelo on 11 October 2023

Hello Sarita,

Place the following code in your Azure DevOps Outgoing Sync

workItem.comments.collect{ comment ->
if(comment.body.contains("@send2Zendesk")){
replica.comments += comment
}
}
replica.comments       = nodeHelper.stripHtmlFromComments(replica.comments)


This code snippet will only add to the replica, the comments that contain the following text: “send2Zendesk”.

Regards,

Javier Pozuelo


Answer by Sarita Bhatt on 12 October 2023

I also tried the reverse from zendesk to ado only for internal comments with below script and it worked

def intc = issue.comments.findAll{it.internal}
def matchingComments = intc.findAll
{
comment ->
comment.body =~ /@send2ado/
}

replica.comments += matchingComments


Answer by Sarita Bhatt on 12 October 2023

Yes it worked…Thanks


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.