I want to display hyper link with record number id if I created a record another table

APV Babu
Tera Contributor

There are two different request tables with different scopes Iam redirecting from table1 to table2 using UI button. If I submit request in table2 I want to display hyper link with request id in table1 can anyone help me, I am new to scripting.

 

 

 

Thanks in Advance!!!

APV Babu

1 REPLY 1

Omkar Ranjane
Tera Guru

Hi @APV Babu,

 

Is there any field which refer table 1 record in table 2 ? 

If yes then create after insert BR in Table 2 & add below code snippet in BR.

 

e.g. table1 : incident, table2 : problem

(function executeRule(current, previous /*null when async*/) {
	var inc = new GlideRecord('incident');
	inc.get(current.first_reported_by_task.toString());
	// first_reported_by_task is field in problem table refering to incident

	// 1st method to create hyperlink
	inc.u_hyperlink = "<a href='" + current.getLink(true) + "' target='_blank'>" + current.number + "</a>" ;
	
	// 2nd method to create hyperlink
	//inc.u_hyperlink = "<a href='incident.do?sys_id=" + current.sys_id + "' target='_blank'>" + current.number + "</a>";

	inc.update();
})(current, previous);

 

Output:

Field type should be HTML.

OmkarRanjane_0-1672727907272.png

 

If your question is solved, please close the topic by marking my answer "Accept as Solution". This will help others searching for a similar question and will remove the topic from the unsolved list.