The CreatorCon Call for Content is officially open! Get started here.

Additional comments on req vs ritm vs sc_task

varunp
Tera Guru

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.

1 ACCEPTED SOLUTION

Andrew Wortham
Kilo Guru

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


View solution in original post

30 REPLIES 30

Looks like you have an error in the first business rule script:

ritm_gr.addQuery('sys_id', current.parent);

should be

ritm_gr.addQuery('parent', current.sys_id);

Awesome, thanks for the catch! I was able to revise my scripts and now have them *mostly* working... but still have an issue:

For some reason, with all four scripts up and running, the initial comment on any one "layer" (REQ, RITM, or Task) duplicates itself, appearing twice. I have yet to figure out how to prevent that duplication

Using these scripts (+ Snehal's for RITM->SCTask and SCTask->RITM, above):

REQ to RITM:

//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('request', current.sys_id);
	ritm_gr.query();
			
	while(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();
		}
	}

RITM to REQ:

//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('sc_request');
	request_gr.addQuery('sys_id', current.request.sys_id.toString());
	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();
		}
}

I found the solution! I noticed my BRs were processing Before update, whereas Snehal's process After. With all 4 BRs set to process after update, all is well

Thanks everyone!

Hope the script was helpful. If yes, mark it as helpful.

Regards,

Snehal M

Rao1
Tera Contributor

This works perfect .. Thanks Snehal