3 answers
- 10-1
Hi Marika,
Can you try it this way?
import com.exalate.basic.domain.hubobject.v1.BasicHubComment; if (replica.assignee) { if (!replica.assignee.equals(previous?.assignee)) { // construct the comment String message = "${replica.key}: Assignee updated from '${previous?.assignee?.displayName}' to '${replica?.assignee?.displayName}'" BasicHubComment hubComment = new BasicHubComment(); hubComment.setBody(message); hubComment.setInternal(false); issue.comments += hubComment } else { // construct the comment String message = "${replica.key}: Assignee updated from 'Unassigned' to '${replica?.assignee?.displayName}'" BasicHubComment hubComment = new BasicHubComment(); hubComment.setBody(message); hubComment.setInternal(false); issue.comments += hubComment } }
Thanks,
André
- André Leroy-Beaulieu Castro
Marika Trygg Hi Marika,
Were you able to try this out? This version should set the comments to public.
Let me know!
Thanks,
André
- Marika Trygg
Hi André Leroy-Beaulieu Castro ,
I tried it out now and I get an error when trying to update the Sync Rules Page, se attached screenshots.
Let me know if you need any more info fram me.
/Marika
- Marika Trygg
Hi André Leroy-Beaulieu Castro ,
is it possible to set up a call to solve this?It's the last thing to solve before we can go live with a process, so I'm eager to get this solved.
/Marika
- Juan Grases
Not sure if still relevant, but I have updated the provided script to avoid that error. It was missing an import:
import com.exalate.basic.domain.hubobject.v1.BasicHubComment;
Best regards,
Juan
CommentAdd your comment... - 10-1
Hi André!
I'm getting an error.
Error Detail Message:
Script error details: No such property: previous for class: Script2119. Error line: Script2119.groovy:29
Seems like it's a problem with "previous".
/Marika
- Marika Trygg
Hi André Leroy-Beaulieu Castro !
Can it be that Assignee is empty upon Creation of the issue?
Therefore it has no "previous"?
Because I get the error when it's a newly created issue, but the script works fine if I enter it and change assignee in an issue that has Assignee set, and I then change it.
So in the case of "Add comment when status is changed", the script works from start, because the issue always has a status?
So the script needs to be able to send a comment in local when remote Assignee field goes from "Unassigned" to "Marika".
Thanks!
/Marika
- André Leroy-Beaulieu Castro
if (replica.assignee) {
if (!replica.assignee.equals(previous?.assignee)) {
// construct the comment
String message = "${replica.key}: Assignee updated from '${previous?.assignee?.displayName}' to '${replica?.assignee?.displayName}'"
issue.comments = commentHelper.addComment(message, issue.comments)
}
else {
// construct the comment
String message = "${replica.key}: Assignee updated from 'Unassigned' to '${replica?.assignee?.displayName}'"
issue.comments = commentHelper.addComment(message, issue.comments)
}
}
Would this be sufficient for you? Let me know if this works :) - Marika Trygg
Thank you for this extended script! Almost there!
The last thing I need is for the comments to be synced as External comments from remote Software to local ServiceDesk project. Right now they become Internal comments and does not show in the customer portal./Marika
- André Leroy-Beaulieu Castro
Hi Marika,
Can I see some screenshots of your scripts right now? I want to see if there is any outside logic that might be creating these comments as internal..
Thanks,
André
CommentAdd your comment... - 10-1
Hi Marika,
Thanks for raising this question
Outgoing (source side):
replica.assignee = issue.assignee
Incoming (destination side):
if (!replica.assignee.equals(previous?.assignee)) { // construct the comment String message = "${replica.key}: Assignee updated from '${previous?.assignee?.displayName}' to '${replica?.assignee?.displayName}'" issue.comments = commentHelper.addComment(message, issue.comments) }
This would add the display name of the assignee but you can change that to username or email depending on your needs. Let me know if this works for you!
And also, can the local issue show the name of current assignee without the assignee being a user in the local jira?
you could set this in a text custom field like so:
Incoming (destination side):
issue.customFields."Remote Assignee".value = replica.assignee?.displayName
Again, you can choose username or email if that's better for you
Thanks,
André
CommentAdd your comment...
Hi!
I'd like to get changes in remote assingee value added as a comment in local issue.
Found this: https://docs.idalko.com/exalate/display/ED/How+to+convert+remote+status+changes+to+local+comments
How can I change it to assignee?
And also, can the local issue show the name of current assignee without the assignee being a user in the local jira?
BR,
Marika