Create a link for Approve/Reject

Prasnajeet1
Giga Guru

Hi All

I am creating a link to approve/reject a request. In my email script I have written below script. When user click on the link it should redirect the user to sysapproval_approver table to that record.

 

template.print('<a href='+gs.getProperty('glide.servlet.uri')+'sysapproval_approver.do?sys_id='
+ current.sys_id + '>' + "Click here to Approve/Reject "+ current.sysapproval.number + '</a>');
 
Ideally the link appeared like: "Click here to Approve/Reject" but this coming like "Click here to Approve/Reject undefined".
Can someone please help to correct the link and helps to achieve the requirement.
 
1 ACCEPTED SOLUTION

Prasnajeet1
Giga Guru

Hi All

Thank you for all your answer. Really appreciated. Finally I am able to fix the issue. Below is the script.

 

template.print('<a href='+gs.getProperty('glide.servlet.uri')+'sysapproval_approver.do?sys_id='
+ current.sys_id + '>' + "Click here to Approve/Reject "+ current.number + '</a>');

View solution in original post

18 REPLIES 18

Hi Anand

Thanks for you quick response.  I try with your script as well. But now nothing is coming. no link, nothing. Its blank.

Do I need to provide my instance url in the script. ( + instanceURL +)

Hi @Prasnajeet1 ,

No need to change url it will differ from instance to instance
I have tried below script in my pdi its working for me

 var instanceURL = gs.getProperty('glide.servlet.uri');
var tableName = 'sysapproval_approver'; 
var myURL = '<a href="' + instanceURL + '/nav_to.do?uri=' + tableName + '.do?sys_id=' + current.sys_id + '">Click here to Approve/Reject ' + current.sysapproval.number + '</a>';
template.print(myURL);

AnandKumarP_0-1707725220316.png


When i click on link navigating to below record

AnandKumarP_1-1707725255332.png

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

my notification and email template is written on sc_req_item.  

Can this be the reason  for that link.

_Gaurav
Kilo Sage

Hi @Prasnajeet1 
Can you try with getDisplayValue() method once?

template.print('<a href='+gs.getProperty('glide.servlet.uri')+'sysapproval_approver.do?sys_id='
+ current.sys_id + '>' + "Click here to Approve/Reject "+ current.sysapproval.getDisplayValue()+ '</a>');

I already tried with this but still getting that undefined value.

Click here to Approve/Reject undefined