ui action

abhi159
Kilo Sage

create a ui action to download the current incident form with the values filled in incident

 

1 ACCEPTED SOLUTION

Hi @abhi159 ,

Try below script in ui action table incident, Client-true,Form Button-True, Onclick- exportPDF(),Show Update Insert-True

AnandKumarP_0-1699252310133.png

 

AnandKumarP_1-1699252671290.png

function exportPDF() {
 var sysparm_table = g_form.getTableName();
 var sysparm_sys_id = g_form.getUniqueValue().toString();
 var instanceName='https://yourdevinstanceurl.service-now.com/';//change this to your instance url
 var url = instanceName+sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id;
 g_navigation.openPopup(url);
}

 

AnandKumarP_2-1699252691866.png

 

AnandKumarP_3-1699252717839.png


Please mark it as helpful and solution proposed if it serves your purpose.

Thanks,

Anand




 

View solution in original post

6 REPLIES 6

Sohithanjan G
Kilo Sage
Kilo Sage

Hi @abhi159 

You can create an UI action button with following:

var currentIncident = g_form.getTableName();
var currentSysId = g_form.getUniqueValue();
var url = currentIncident + '.do?sys_id=' + currentSysId + '&PDF';

g_navigation.open(url);

 

Mark as accepted solution & hit helpful buttton if it suffices your requirement.

 

BR, Sohith

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

not working

 

Hi @abhi159 ,

Try below script in ui action table incident, Client-true,Form Button-True, Onclick- exportPDF(),Show Update Insert-True

AnandKumarP_0-1699252310133.png

 

AnandKumarP_1-1699252671290.png

function exportPDF() {
 var sysparm_table = g_form.getTableName();
 var sysparm_sys_id = g_form.getUniqueValue().toString();
 var instanceName='https://yourdevinstanceurl.service-now.com/';//change this to your instance url
 var url = instanceName+sysparm_table + '.do?PDF&sys_id=' + sysparm_sys_id;
 g_navigation.openPopup(url);
}

 

AnandKumarP_2-1699252691866.png

 

AnandKumarP_3-1699252717839.png


Please mark it as helpful and solution proposed if it serves your purpose.

Thanks,

Anand




 

Ankur Bawiskar
Tera Patron
Tera Patron

@abhi159 

what you want to download? download a pdf of the incident record? OR something else?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader