Is there a way to send comments on exalate actions?

Originally asked by Dewayne Lavelle on 03 February 2021 (original question)


Hello,

Can we send automatic comments to one side of the sync on specific exalate actions? for example, if the ticket gets assigned can we send an automatic comment to the other system?


Answer by André Leroy-Beaulieu Castro on 04 February 2021

Hi Dewayne,

Thanks for raising this community question.

There is no way for you to send the comment on a specific action, but what you can do, is add a comment statically on the receiving side when a certain action happens on the sending side. So for example, if side A gets assigned, you can add a comment on side B saying “Side A got assigned.” Here’s how you would accomplish that:

//Incoming Sync Side B:
if (!firstSync) {
	if (replica.assignee != null && previous.assignee == null) {
		issue.comments = commentHelper.addComment("Remote ticket assigned", false, issue.comments)
	}
}

The “false” as a second parameter to the .addComment method means that you don’t want this comment to sync back to Side A in the subsequent synchronizations. I assume this is how you would like it to be, but if you do want this comment to sync back to Side A you can just set it to true.

Let me know if this satisfies your use case!

Thanks,

André


Answer by Dewayne Lavelle on 04 March 2021

Thanks so much for all of your time and effort. This issue can be closed. Everything is working for me.


Answer by Dewayne Lavelle on 04 March 2021

This looks like it is working for me now. I just need a solution for the CLOSED piece I mentioned above.


Answer by André Leroy-Beaulieu Castro on 04 March 2021

Hi Dewayne,

Yes, the assignee needs to be sent from side A so that side B can apply that logic in the incoming, that doesn’t mean that the assignee will be set on side B, it just means you are sending that info from A so that side B can apply the correct logic when it realizes side A has set an assignee.

the line you need in your outgoing of side A is:

replica.assignee = issue.assignee

For your second question, if you wanted to add a static comment on B when side A is closed, you could apply a logic like this one:

//Incoming Sync Side B:
if (!firstSync) {
	if (replica.status.name == "Closed" && previous.status.name != "Closed") {
		issue.comments = commentHelper.addComment("Remote ticket was closed", false, issue.comments)
	}
}

Thanks,

André


Answer by Dewayne Lavelle on 04 March 2021

I had to add a comment to the side A before the assignment comment was added.


Answer by Dewayne Lavelle on 04 March 2021

Do I need to be sending Assignee from Side A? We dont send the Assignee from A to B because that should never change for us on side B. it needs to stay the same.

I am using the code you sent me below:

//Incoming Sync Side B:
if (!firstSync) {
	if (replica.assignee != null && previous.assignee == null) {
		issue.comments = commentHelper.addComment("Remote ticket assigned", false, issue.comments)
	}
}

I am doing this on Side B in the incoming rules but I am not seeing the comment being added. I think it may be because I am not sending the Assignee from A to B???


Answer by Dewayne Lavelle on 03 March 2021

Lets say i wanted to send a comment when an issue is closed on side A to side B. how would i handle that?