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 ,

 

Can you check the table on which you have write the email script?

Kindly confirm your script is on Approval [sysapproval_approver] table.

 

Mark helpful if assists.

Thank you!

my notification and email template is written on sc_req_item.  

i guess this is the problem

Yes..

Kindly try using the table I mentioned. (ie. sysapproval_approver)

Please mark this as helpful if this resolves your query.
Thanks!

@Prasnajeet1 YES!
I thought you have written it on Approval table, that is the reason you're not getting current.sysapproval.number.

Please mark this as helpful if this resolves your query.
Thanks!

Anand Kumar P
Giga Patron
Giga Patron

Hi @Prasnajeet1 ,

Use below script

 

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

 

 

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