<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to get the last comment in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417773#M74699</link>
    <description>&lt;P style="text-align: justify;"&gt;Hi,&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;go through below threads,&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;1)&amp;nbsp;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=8a274729db1cdbc01dcaf3231f961998" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=8a274729db1cdbc01dcaf3231f961998&lt;/A&gt;&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;2)&amp;nbsp;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=36cdcb6ddb9cdbc01dcaf3231f9619c6" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=36cdcb6ddb9cdbc01dcaf3231f9619c6&lt;/A&gt;&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;3)&amp;nbsp;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=1f1e1642db9ea740b1b102d5ca9619cc" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=1f1e1642db9ea740b1b102d5ca9619cc&lt;/A&gt;&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;4)&amp;nbsp;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=4aa903e5db5cdbc01dcaf3231f9619ef" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=4aa903e5db5cdbc01dcaf3231f9619ef&lt;/A&gt;&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;Thanks,&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;Vishal&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2019 12:43:07 GMT</pubDate>
    <dc:creator>Vishal Khandve</dc:creator>
    <dc:date>2019-07-10T12:43:07Z</dc:date>
    <item>
      <title>How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417763#M74689</link>
      <description>&lt;P&gt;we are sending a notification when the RITM is complete. The body should have the last comment in the body without timestamp.&lt;/P&gt;
&lt;P&gt;How can i achieve this?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 09:00:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417763#M74689</guid>
      <dc:creator>SNOW39</dc:creator>
      <dc:date>2019-07-09T09:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417764#M74690</link>
      <description>&lt;P&gt;&lt;A href="https://developer.servicenow.com/app.do#!/api_doc?v=london&amp;amp;id=SGE-getJournalEntry_N" rel="nofollow"&gt;https://developer.servicenow.com/app.do#!/api_doc?v=london&amp;amp;id=SGE-getJournalEntry_N&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;oh without timestamp, it is sad that service now does not provide this feature without timestamps.&lt;/P&gt;
&lt;P&gt;We removed the annoying part with regex.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 09:03:57 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417764#M74690</guid>
      <dc:creator>David Stutter</dc:creator>
      <dc:date>2019-07-09T09:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417765#M74691</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try something like this :-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var worknotes = current.work_notes.getJournalEntry(1);&lt;/P&gt;
&lt;P&gt;var&amp;nbsp;onlyNotes = worknotes.split("(Work notes)\n");&lt;/P&gt;
&lt;P&gt;&amp;nbsp;var lastWorknote = onlyNotes&amp;nbsp;[1];&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 09:07:12 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417765#M74691</guid>
      <dc:creator>Omkar Mone</dc:creator>
      <dc:date>2019-07-09T09:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417766#M74692</link>
      <description>&lt;P&gt;can try this&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; var wn1 = target.work_notes.getJournalEntry(1);&lt;BR /&gt; var wn2 = wn1.split("(Work notes)");&lt;BR /&gt; wn2.splice(0,1);&lt;BR /&gt;var work_notes = ' Work Notes: ' + wn2;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 09:12:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417766#M74692</guid>
      <dc:creator>Harish KM</dc:creator>
      <dc:date>2019-07-09T09:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417767#M74693</link>
      <description>&lt;P&gt;Below links could help you out :&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=65a403e9dbd8dbc01dcaf3231f9619a5" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=65a403e9dbd8dbc01dcaf3231f9619a5&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=6a1a0b69db5cdbc01dcaf3231f96198d" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=6a1a0b69db5cdbc01dcaf3231f96198d&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Ravi&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 09:15:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417767#M74693</guid>
      <dc:creator>SaiRaviKiran Ak</dc:creator>
      <dc:date>2019-07-09T09:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417768#M74694</link>
      <description>&lt;P&gt;tried this.. not working&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 09:57:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417768#M74694</guid>
      <dc:creator>SNOW39</dc:creator>
      <dc:date>2019-07-10T09:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417769#M74695</link>
      <description>&lt;P&gt;The solution suggested by Omkar and others should work if the field name is work_notes and the label is "Work Notes". Just wanted to check are you trying to retrieve the last work notes added or the last additional comments added to the RITM? If it is additional comments, you will need to tweak the code accordingly.&lt;/P&gt;
&lt;P&gt;Also, I am assuming you already have the email script to get the comments printed in your email notification; would you be able to share the code written in the email script? That would help people to suggest you changes.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Manish&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 11:06:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417769#M74695</guid>
      <dc:creator>Manish Vinayak1</dc:creator>
      <dc:date>2019-07-10T11:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417770#M74696</link>
      <description>&lt;P&gt;i am looking for comments not worknotes&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 11:08:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417770#M74696</guid>
      <dc:creator>SNOW39</dc:creator>
      <dc:date>2019-07-10T11:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417771#M74697</link>
      <description>&lt;P&gt;am looking for comments not worknotes!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 11:09:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417771#M74697</guid>
      <dc:creator>SNOW39</dc:creator>
      <dc:date>2019-07-10T11:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417772#M74698</link>
      <description>&lt;P&gt;Create a Notification Email Script (mail script), use the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var commentsArr = current.comments.getJournalEntry(1).split("\n");&lt;BR /&gt; commentsArr.shift();&lt;BR /&gt; template.print(commentsArr.join("\n"));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then refer your email script in your notification content, using {$mail_script:your_mail_script_name_goes_here}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Refer to the documentation&amp;nbsp;&lt;A href="https://docs.servicenow.com/bundle/london-servicenow-platform/page/script/server-scripting/concept/c_ScriptingForEmailNotifications.html" rel="nofollow"&gt;https://docs.servicenow.com/bundle/london-servicenow-platform/page/script/server-scripting/concept/c_ScriptingForEmailNotifications.html&lt;/A&gt;&amp;nbsp;for more details on using mail script.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 11:21:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417772#M74698</guid>
      <dc:creator>Manish Vinayak1</dc:creator>
      <dc:date>2019-07-10T11:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the last comment</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417773#M74699</link>
      <description>&lt;P style="text-align: justify;"&gt;Hi,&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;go through below threads,&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;1)&amp;nbsp;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=8a274729db1cdbc01dcaf3231f961998" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=8a274729db1cdbc01dcaf3231f961998&lt;/A&gt;&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;2)&amp;nbsp;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=36cdcb6ddb9cdbc01dcaf3231f9619c6" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=36cdcb6ddb9cdbc01dcaf3231f9619c6&lt;/A&gt;&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;3)&amp;nbsp;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=1f1e1642db9ea740b1b102d5ca9619cc" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=1f1e1642db9ea740b1b102d5ca9619cc&lt;/A&gt;&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;4)&amp;nbsp;&lt;A href="https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=4aa903e5db5cdbc01dcaf3231f9619ef" rel="nofollow"&gt;https://community.servicenow.com/community?id=community_question&amp;amp;sys_id=4aa903e5db5cdbc01dcaf3231f9619ef&lt;/A&gt;&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;Thanks,&lt;/P&gt;
&lt;P style="text-align: justify;"&gt;Vishal&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 12:43:07 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-get-the-last-comment/m-p/1417773#M74699</guid>
      <dc:creator>Vishal Khandve</dc:creator>
      <dc:date>2019-07-10T12:43:07Z</dc:date>
    </item>
  </channel>
</rss>

