Number as hyper link

shaik23
Tera Expert

Hi all,

 

i want Number as hyper link (Incident,problem,Hr profile tables) when we click on context menu just like copy to clipboard i have created a context menu as HTML-formatted link when user click on this the incident number should be copied as hyperlink, screen shot shared below for reference

shaik23_0-1738152239555.png

 

By using below code i am able to copy the Number as text.

runContextNumberAction();

function runContextNumberAction(){
var gr = new GlideRecord(g_list.getTableName());
gr.get(g_sysId);
copyToClipboard(gr.number);
}

i need help on this.

Thanks.



5 REPLIES 5

Sandeep Rajput
Tera Patron
Tera Patron

@shaik23 You can try building the link using the following.

 

runContextNumberAction();

function runContextNumberAction(){
var gr = new GlideRecord(g_list.getTableName());
gr.get(g_sysId);
var instanceURL = gs.getProperty('glide.servlet.uri');
var recordURL = instanceURL + '/nav_to.do?uri=incident.do?sys_id=' + gr.getUniqueValue(); // Construct the link
// Create HTML-formatted link
var htmlLink = `<a href="${recordURL}" target="_blank">gr.getValue('number')</a>`;

copyToClipboard(htmlLink);
}

Hi @Sandeep Rajput  Thanks for responding
 what is type of the context menu should be selected is it  action or Dynamic action if Dynamic actions we have to write script for that too right ?

@Sandeep Rajput  Tried Not working selected type - Action, Nothing copied to clipboard

@shaik23 Please add logs to see of the link is getting generated correctly or not.