How to create "Copy incident number" like "Copy sys_id" (Context menus)?

prasanna7869
Mega Expert

Hi Team,

We need one requirement like below:

As all knows, we can copy the sys_id/copy URL from top of each ticket. In the same way, how can we copy the Particular incident ticket number with URL? we need to implement same link like copy the sys_id/copy URLcontect menus (Copy Incident Number).

For example, If I right click on incident ticket it will give incident number with url :like this INC001234

Please help me to provide solution.

Thanks & Regards,

Prasanna Kumar

15 REPLIES 15

Hi Prasanna,



For what it's worth, the URL you gave is not a valid format. There's no such field as task_id in the dictionary (for an OOB instance.) Records are referred to by table and unique sys_id. Potentially a document ID, which still includes a table and sys_id. If you want the number, you would need to include it in a sysparm_query. Something like this.



https://instancename.service-now.com/nav_to.do?uri=/tablename.do%3Fsysparm_query%3Dnumber%3DINC00000...



Hopefully we have some flexibility in the requirements to make this work. Once we agree the line in bold above is acceptable, we can start looking at how to copy it to the clipboard.



This all comes from: Navigating by URL - ServiceNow Wiki


Yes Chuck,



It'll work. Thank you for valuable solution. Please provide how can we add this into particular ticket header.     Please see the below screenshot:



find_real_file.png



Please suggest solution for the same.



Thanks & Regards,


Prasanna Kumar


Thanks. While I understand your requirement, I don't see an easy way to do it. There are a lot of undocumented features used in the existing Copy URL and Copy sys_id that I am unable to decipher without a few hours and several emails to developers.



My recommendation is to continue to use Copy URL as it provides the same functionality (a link to the record.) The only difference being is the actual URL being copied.



A simpler solution might be to go to System UI> UI Context Menus, and replicate/rename Copy URL to Copy Number.


Chuck Tomasi
Tera Patron

I would use one of the existing ones (Copy SysID or Copy URL) as an example. Go to System UI> Context Menus and make a copy.



https://YOURINSTANCE.service-now.com/nav_to.do?uri=sys_ui_context_menu.do?sys_id=eaeb7ec50a0a0b3e00e...



Doesn't seem hard to modify.



Reference: Context Menus - ServiceNow Wiki


Hi Tomasi,



Please provide the script for the same. It would be very helpful to us.



Thanks & Regards,


Prasanna Kumar