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

Snehal2
Kilo Guru

Hi Varun,

I was also struggling to achieve this and finally found the solution to achieve it and this will not loop the commenting from RITM to SCTASK and vice versa.

Following 4 BR can be written to get the comments to and fro - Request,RITM,SCTASK

1. Copy Comments from Request to RITM

2. Copy Comments from RITM to SCTASK

3. Copy Comments from SCTASK to RITM

4. Copy Comments from RITM to Request

You Can try out following:

LOGIC USED:

EG: To copy RITM additional comment to its SCTASKs -> compare the most recent comment on SCTASK with the RITM comment, if no match found then update additional comment on the SCTASK. Use the same logic for vica versa i.e sctask to RITM.

1. BR: Add Comments from RITM to all SCTASKs  (After Insert and update) Condition: on change of additional comments

//To Copy the Additional Comments from RITM to SCTASKs
    var compare,ritm_comment2,ritm_comment,task_comment2,task_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 task_gr = new GlideRecord('sc_task');
	task_gr.addQuery('parent', current.sys_id);
	task_gr.query();
	
	while(task_gr.next())
	{
		task_comment =task_gr.comments.getJournalEntry(1);
		
		//Remove timestamp and name from additional comment
		var i1 = task_comment.search(regex);
		if(i1 > 0)
		{
			task_comment2 = task_comment.substring(i1+1, task_comment.length);	
		}
		compare = ritm_comment2.indexOf(task_comment2);
		
		if(compare == -1)  // If No match found
		{
			task_gr.comments = ritm_comment2.trim();
			task_gr.update();
		}
	}	

2. BR: Add Comments from SCTASK to RITM(After Insert and update) Condition: on change of additional comments

//To Copy the Additional Comments from SCTASK to RITM
	var compare,task_comment2,task_comment,ritm_comment2,ritm_comment;
	task_comment =current.comments.getJournalEntry(1);
	
	//Remove timestamp and name from additional comment
	var regex= new RegExp('\n');
	var i = task_comment.search(regex);
	if (i>0)
	{
		task_comment2 = task_comment.substring(i+1, task_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 = task_comment2.indexOf(ritm_comment2);
		
		if(compare == -1)  // If No match found
		{
			ritm_gr.comments = task_comment2.trim();
			ritm_gr.update();
		}		
	}

Similarly u can write other 2 BR. Mark it correct if it helps you. Its tested code.

Regards,

Snehal Madakatti

Finally, a solution that works really well. Thanks for sharing

Hi Snehal, I used the same script as-is. However, it is duplicating the comment on catalog task.

 

Can you check? 

 

Hi Alka,

did you find resolution for this ?

I am also getting duplicate comments in catalog task.Please let me know.

Thanks .

 

 

Hi,

I have tested this script, and it worked well. Please check the script, might be something is missed.

Regards,

Snehal