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 @Prasnajeet1 

Verify whether there is any value in sysapproval field for the record you are trying to trigger email..

if sysapproval field in the sys_approval record is empty then it will show undefined.

If you are using previw notification feature and choosing any record from sysapproval_approver table, may be you are choosing records with empty sysapproval field..please verify that once

Hi Sarika

Yes I am using the preview notification and I have validated, in the sysapproval_approver is not empty. Still that link is not coming properly. Can you please help with the below script.

 

 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>');
 
I have also tried below script
 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.getDisplayValue() + '</a>');

my notification and email template is written on sc_req_item.  

This could be reason I am getting the link like that 

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>');