We select any value from site table in incident form in that knowledge records need to be pop up in

mania
Tera Contributor

Hi,

 

Site field is reference field it will reflect to site table. 

mania_1-1695646673372.png

once we select any of the value in site field we need to go that particular table. There we have Knowledge in related list. That particular knowledge records will be replicate to Incident related knowledge related list in incident form.

mania_2-1695646893745.png

mania_3-1695647204063.png

Can you anyone please help me or can you please provide me any code for this it is useful for me.

 

Thanks in Advance!

 

2 REPLIES 2

Mayur2109
Kilo Sage
Kilo Sage

Hi @mania ,

 

For your reference I have created Knowledge From Problem related list (Related Knowledge in your case) coming from problem related knowledge (reference table for Site field in your case). Knowledge and task relation you can find in m2m_kb_task table.

 

Please find attached screenshot for more information.

Refer below script to populate list on incident table. (use sys_relationship for script implementation, make required changes).

 

(function refineQuery(current, parent) {

	// Add your code here, such as current.addQuery(field, value);
	var attachedKBIDs = [];
	var prb = parent.problem_id;
	gs.addInfoMessage(prb);
		var kbGr = new GlideRecord('m2m_kb_task');
		kbGr.addQuery('task',prb);
		kbGr.query();
		if(kbGr.next())
		{
			attachedKBIDs.push(kbGr.getValue("kb_knowledge"));

		}		

current.addQuery('kb_knowledge.sys_id', 'IN', attachedKBIDs);

})(current, parent);

 

 

Please check and Mark Helpful and Correct if it really helps you.

Regards,
Mayur Shardul

mania
Tera Contributor

Hi @Mayur2109 

 

We have two reference fields it will reflected to some other tables in that tables we have a contact related list so based on the Account and site selected, caller should only show the contacts under them

 

Can you please help me it will useful for me.

mania_1-1695717286561.png

 

Thanks!

Mania