- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 12:53 PM
Hi All,
We are implementing a service now from scratch. I am seeing there are additional comments on Request, RITM as well as on Sc_Task.
The requester can only see additional comments of Request from Portal. And fulfiller can only see the additional comments from sc_task.
I want to know what is the best practice of using the additional comments.
Should I copy Request additional comments to sc_task and vice-versa so that requester and fulfiller both see the same additional comments and skip the RITM additional comments because it is of no use? If I do the same then how do I avoid the infinite loop?
In my organization, 1 Req will only have 1 RITM, but 1 RITM can have more than 1 task. If I need to copy Request additional comments to task, I need to copy in all sc_task. And when any fulfiller will add any additional comments on sc_task, I need to copy it to Request so that requester can see the fulfiller comments on Portal.
Any comments would be helpful.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-30-2017 01:48 PM
Hello Varun,
This is a very common question! Best practice in my experience is to hide the REQ for end users. Typically it is easier for the end users to deal with a single ticket and the RITM level is the natural ticket for them to know. However, this does take a bit of configuration. Including changing the portal to show RITMs in the menus and lists. And changing the notifications to navigate to the portal (this needs to be changed regardless)
As to end user - fulfiller communication, the RITM is often the place where this should occur, set up notifications / inbound actions on the RITM and train fulfiller to go up a level to communicate since sc_tasks just have work notes. I have seen and implemented business rules for some clients that carry additional comments up to the RITM and back down so that fulfillers can live at the task level while end users only see RITMs. Both work.
If you opt to try and use REQ as the point of contact you will have to add additional comments and work notes to the REQ.
In short no matter what you choose there is going to be some configuration involved and the most important part is that you get to a process that works for both the end users and fulfillers. But I would recommend using the RITM as the primary record for communication.
Best,
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2019 08:15 AM
This is almost exactly what I was looking for - SCTASK to RITM works beautifully- so thank you so much!
However, I'd like to tweak the RITM to all SCTASKs to only go to open tasks, instead of all, and I'm not quite sure how to do that; my js is not strong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2019 05:49 AM
@Monicask.
You just need to add additional condition as below for - RITM to all SCTASKs to only go to open tasks
var task_gr = new GlideRecord('sc_task');
task_gr.addQuery('parent', current.sys_id);
task_gr.addQuery('state', 17);//back end value of open state
task_gr.query();
Regards,
Snehal M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2020 01:06 PM
This was extremely helpful as a prior solution I found required indexing on a prefixed phrase such as "Update from Task" which I didn't necessarily want to expose to users via a notification email. Thanks!
For anyone else who may find this helpful, here is my version very slightly modified re: variable names for ease of readability.
Name: Copy sc_req_item comments to sc_task
On After, On Update, Condition: current.comments.changes()
(function executeRule(current, previous /*null when async*/) {
var compare;
var task_comment;
var task_comment_clean;
var ritm_comment;
var ritm_comment_clean;
ritm_comment = current.comments.getJournalEntry(1);
// Remove timestamp and name from additional comment
var regex = new RegExp('\n');
var i = ritm_comment.search(regex);
if (i > 0) {
ritm_comment_clean = ritm_comment.substring(i+1, ritm_comment.length);
}
// Get the child SCTASKs
var sctask = new GlideRecord('sc_task');
sctask.addQuery('parent', current.sys_id);
sctask.query();
while (sctask.next()) {
task_comment = sctask.comments.getJournalEntry(1);
// Remove timestamp and name from additional comment
var j = task_comment.search(regex);
if (j > 0) {
task_comment_clean = task_comment.substring(j+1, task_comment.length);
}
compare = ritm_comment_clean.indexOf(task_comment_clean);
if (compare == -1) // If no match is found
{
sctask.comments = ritm_comment_clean.trim();
sctask.update();
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-29-2020 10:46 PM
Glad that this script was helpful Adam 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2020 06:52 AM
Hi Snehal,
I've been attempting to implement your solution, but something is off with my attempt at scripting the two remaining business rules (REQ to RITM, RITM to REQ), could you please help me understand what I'm doing wrong?
To add comments from REQ to RITM (table is sc_request, condition is current.comments.changes()):
//To Copy the Additional Comments from REQ to RITM
var compare,request_comment2,request_comment,ritm_comment2,ritm_comment;
request_comment =current.comments.getJournalEntry(1);
//Remove timestamp and name from additional comment
var regex= new RegExp('\n');
var i = request_comment.search(regex);
if (i>0)
{
request_comment2 = request_comment.substring(i+1, request_comment.length);
}
var ritm_gr = new GlideRecord('sc_req_item');
ritm_gr.addQuery('sys_id', current.parent);
ritm_gr.query();
if(ritm_gr.next())
{
ritm_comment =ritm_gr.comments.getJournalEntry(1);
//Remove timestamp and name from additional comment
var i1 = ritm_comment.search(regex);
if(i1 > 0)
{
ritm_comment2 = ritm_comment.substring(i1+1, ritm_comment.length);
}
compare = request_comment2.indexOf(ritm_comment2);
if(compare == -1) // If No match found
{
ritm_gr.comments = request_comment2.trim();
ritm_gr.update();
}
}
To add comments from RITM to REQ (table is sc_req_item, condition is current.comments.changes()):
//To Copy the Additional Comments from RITM to REQ
var compare,ritm_comment2,ritm_comment,request_comment2,request_comment;
ritm_comment =current.comments.getJournalEntry(1);
//Remove timestamp and name from additional comment
var regex= new RegExp('\n');
var i = ritm_comment.search(regex);
if (i>0)
{
ritm_comment2 = ritm_comment.substring(i+1, ritm_comment.length);
}
var request_gr = new GlideRecord('request');
request_gr.addQuery('parent', current.sys_id);
request_gr.query();
while(request_gr.next())
{
request_comment =request_gr.comments.getJournalEntry(1);
//Remove timestamp and name from additional comment
var i1 = request_comment.search(regex);
if(i1 > 0)
{
request_comment2 = request_comment.substring(i1+1, request_comment.length);
}
compare = ritm_comment2.indexOf(request_comment2);
if(compare == -1) // If No match found
{
request_gr.comments = ritm_comment2.trim();
request_gr.update();
}
}