Function returns true value

Hello team,

Wondering if you could help. Every-time I reject a leave request, the script returns true value. Can you please help?

 function doGet(e){
  var answer = (e.parameter.approval =='true')? 'Appoved!' :'not approved';
   MailApp.sendEmail("","Approved Request", "Your manager said: "+answer);

return… what? You havent… told it what to return?
Which means this function will return undefined.

My apologies, below is the code. I have created two links – Approve and Reject which appear in the email. Now, when I hit Approve link the script should return the answer as Approved and when I reject, the answer should be ‘Not approved’.

I tried to find where the issue is, unfortunately, unable to. Need help

function sendEmail(e) {
var url ='***************************************/exec';

var approve = url + '?approval==true'+'?reply='+email;
var reject = url + '?approval==false'+'?reply='+email;

           "<a href ="+ approve +"> Approve</a><br />"+
           "<a href ="+reject+">Reject</a> <br />"+
  MailApp.sendEmail("", "Approval Request", "what no html?", {htmlBody: html});

Well, for starters:

too many equals signs.

for second:

URL query strings contain exactly one ?. multiple parameters are separated by ampersands (&).

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.