Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

In incident form inform message shows linktext.

vinod96
Tera Contributor

in incident table four incident records is created. 3 is the duplicate and one is the original one. In this case i have open record any one in 3 duplicate record.  In this duplicate record  form shows a info message please select the INC00023(original record). User click the INC00023 then it will be automatically open a INC00023 record. 

 

In these case how to create a link text(INC00023).

please help to writ a script. It is very helpful.

 

Thanks.

1 REPLY 1

Peter Bodelier
Giga Sage

Hi @vinod96 

 

You can do it like this. Please adapt it to your use case;

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
	var incidentSys_ID = '<<sys_id of the incident to link to>>';
        var incidentNum = 'INC0000001';
	// build the link and clickable text, set it equal to a variable
	var link = '<a href="nav_to.do?uri=incident.do?sys_id=' + incidentSys_ID  + '" target="_blank">' + incidentNum  + '</a>'

	// add the form message, using strings and the link variable that was built above
	g_form.addInfoMessage('This is a duplicate of ' + link);
	
}

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.