Include author full name in comments from ServiceNow

Originally asked by Alvaro Jardon on 14 May 2021 (original question)


Greetings,

We have a ServiceNow-Jira integration. When a comment is integrated from ServiceNow to Jira, the comment adds to the body “${author_username} commented: ${body}”

Our client has asked if we can change that username for the author’s fullname, but we found that the information we’re recieveing in Jira from ServiceNow comments is as follows:

So no fullname for the author, just the key. Is there a way to format these comments on ServiceNow outgoing sync, before being sent to Jira?

Thanks in advance, kind regards,
Alvaro.


Answer by Serhiy Onyshchenko on 14 May 2021

Hello, Alvaro Jardon
Thanks for reaching out on community!
Here’s the code I used in my outgoing script on SNOW to make it work:

    replica.comments = replica.comments
      .collect { c ->  
          def authorKey = c.author.key
          def a = nodeHelper.getUserByUsername(authorKey)
          if(a) {
              c.author = a
          }
          c
      }

And here’s a video showing how it worked out in Jira :popcorn::

Let me know if it also works for you!
Regards, Serhiy.


Comments:

Alvaro Jardon commented on 17 May 2021

Hi Serhiy Onyshchenko,

Thanks for the help, that did work correctly, thank you!

Kind regards,

Alvaro.

Serhiy Onyshchenko commented on 18 May 2021

Thanks for letting me know, Alvaro Jardon.

Happy Exalating!

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