How to insert RITM AND REQ on interaction record

mounikakodu
Tera Contributor

How can I insert a RITM record into the "Related Tasks" related list of an Interaction record? There is a "Create Request" button on the Interaction record, and upon clicking that button, a list of items to request is displayed. Currently, the request number populates in the "Related Tasks" related list, but I want to display the corresponding RITM of that request AND request number.

3 REPLIES 3

swapnali ombale
Kilo Sage

Hi @mounikakodu 

 

1. The 'Related Task' in the Interaction related list is populated from a Relationship called 'Related Task'. The records which are populated in the Related list are determined from the interaction_related_record Table

2. As per OOB configurations, there is only a link between REQ and Interaction records i.e through the parent_interaction field.But there is no direct link between RITM and Interaction. So, to fulfill my requirement, a new field called u_parent_interaction was created in the RITM table which is referencing the Interaction table.
Then, created a Before query insert BR on RITM table, which sets the u_parent_interaction same as request.parent_interaction.

3. Another 'after' business rule has been configured which executes when parent interaction field value changes, to created new record on Interaction Related Records table. 

var ir = new GlideRecord('interaction_related_record');
ir.initialize();
ir.document_id = current.sys_id;
ir.document_table = current.getTableName();
ir.interaction = current.u_parent_interaction;
ir.insert();
}

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Ankur Bawiskar
Tera Patron
Tera Patron

@mounikakodu 

the related list shows REQ

You can create a defined relationship between RITM and Interaction table and add that in related list on your form in the correct view

1) create new record here "sys_relationship" and remember in REQ field parent_interaction holds the Interaction sysId

(function refineQuery(current, parent) {

	current.addQuery('request.parent_interaction' , parent.sys_id);

})(current, parent);

AnkurBawiskar_4-1744292287046.png

 

 

2) then add the related list on Form -> Configure -> Related lists

AnkurBawiskar_2-1744292158882.png

 

AnkurBawiskar_3-1744292201429.png

 

Output:

AnkurBawiskar_5-1744292356431.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@mounikakodu 

Hope you are doing good.

Did my reply answer your question?

Members have invested their time and efforts in helping you.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader