How to add link for each task

nikhitha24
Tera Guru

Hi Team,

 

Can someone please help me on below query,

Hiring manager receiving an email with all the task assigned to him, once he received the email he wanted to open the each task from email. if we click on the each task from mail, task should open, 

How to add the link for each task , to open from the email.

Please help me on this.

 

Thank you..

nikhitha24_0-1698945880250.png

 

2 ACCEPTED SOLUTIONS

replace the 

template.print( "<td><left>"+gr.getDisplayValue('number')+"</left></td>" );

with

template.print('<td><left><a href="https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=sn_hr_core_task.do?sys_id=' + gr.sys_id + '">' + gr.number + '</a></left></td>');

you can interchange the gr.number with gr.getDisplayValue('number') , if it not work .. however it should because gr result-set on sn_hr_core_task table. let me know if it works for you.

 

 

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

View solution in original post

Hi @nikhitha24 

 

Do what @AshishKM  already mentioned, but change the url:

 

template.print('<td><left><a href="https://' + gs.getProperty('instance_name') + '.service-now.com/esc?id=hrm_todo&view=sp&sysparm_tableName=sn_hr_core_task&sys_id=' + gr.sys_id + '">' + gr.number + '</a></left></td>');

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

View solution in original post

9 REPLIES 9

AshishKM
Kilo Patron
Kilo Patron

Hi @nikhitha24,

How this notification is printing the 2 column data , any notification script capturing the HR-Task from HR-Case.

Check the script part , where this table is being prepared then you have to add record link in the template.

 

https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/administer/notification/concept/c_...


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

@AshishKM  Yes we have created Notification email script, that email script printing the data

 

var gr = new GlideRecord("sn_hr_core_task");
gr.addQuery('parent', current.sys_id);
var assignee = gr.addQuery('assigned_to', current.opened_for);
assignee.addOrCondition('assigned_to', current.subject_person);
 
gr.addEncodedQuery('active=true^sn_hr_le_activity.ref_sn_hr_le_activity.activity_set=bbc79f9387882150c7ed315e0ebb35b3^ORsn_hr_le_activity.ref_sn_hr_le_activity.activity_set=4007d79387882150c7ed315e0ebb350f^stateNOT IN3,4,7,9');
 
gr.query();
 
template.print("<b>Below HR Tasks are Assigned To you:</b>");
template.print('<table border="1px solid black;padding:10px;font-family:Arial;font-size:10pt;border-top:0px">');
 
template.print( "<tr>" );
template.print( "<td><left><b>Short Description</b></left></td>" );
template.print( "<td><left><b>Number</b></left></td>" );
template.print( "</tr>" );
 
while (gr.next()) {
template.print( "<tr>" );
template.print( "<td><left>"+gr.short_description+"</b></left></td>" );
template.print( "<td><left>"+gr.getDisplayValue('number')+"</left></td>" );
template.print( "</tr>" );
}
 
can you please suggest how to add the link for each task, so that Hiring manager click on each link to open the task from email.

replace the 

template.print( "<td><left>"+gr.getDisplayValue('number')+"</left></td>" );

with

template.print('<td><left><a href="https://' + gs.getProperty('instance_name') + '.service-now.com/nav_to.do?uri=sn_hr_core_task.do?sys_id=' + gr.sys_id + '">' + gr.number + '</a></left></td>');

you can interchange the gr.number with gr.getDisplayValue('number') , if it not work .. however it should because gr result-set on sn_hr_core_task table. let me know if it works for you.

 

 

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

@AshishKM  

 

Hiring manager receiving an email with all the task assigned to him, once he received the email he wanted to open the each task , once we click on task and it should navigate to employee center , not to the native instance of task form.

see the attached screenshot for reference.

nikhitha24_0-1699028873981.png