Yes, that is possible. You would have to create some webapps to handle the button responses, but it is quite doable and I have done that in the past.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/850a4dfd-e877-4df4-9ba8-ce3fe77bd9a8n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/zMGzlfoCP2I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/004601d7aa74%24a8f7a850%24fae6f8f0%24%40gmail.com.
Dora,
Here is how I have done it in the past:
Here is a script that generates the email with the buttons:
function generateApproveButtonEmailContent()
{
var msgBody = "";
const orgName = "Someone";
const approvalWebApp = https://.../; // insert your web app exec address
const approveButton = https://dl.dropboxusercontent.com/s/..../Approve.png?dl=0; // this is approve button picture
const declineButton = https://dl.dropboxusercontent.com/s/.../Decline.png?dl=0; // this is decline button picture
var approveURL = approvalWebApp + "&Approval=Approved";
var declineURL = approvalWebApp + "&Approval=Declined";
msgBody += "<p>This message is for: " + orgName + ",</p>";
msgBody += "<p>We have a new request available for you.</p>";
msgBody += "<p>To approve this email request click approve button.</p>";
msgBody += "<p align=center style='text-align:center'><span><a href=" + approveURL;
msgBody += "><span><img border=0 width=195 height=60 id=Img1 src=" + approveButton + "></span></a></span></p>";
msgBody += '</div>';
msgBody += "<p>To decline this email request click decline button.</p>";
msgBody += "<p align=center style='text-align:center'><span><a href=" + declineURL;
msgBody += "><span><img border=0 width=195 height=60 id=Img2 src=" + declineButton + "></span></a></span></p>";
return msgBody;
};
To use something like this you would need to do the following:
Hope this helps.
George
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAOiVUnQJpwRmhjBr9ujXmmCmO3%2ByH3yjJJy-Z%2BbGtbd_Ff_53A%40mail.gmail.com.
Hi Dora,
Glad you found it useful. Yes, you can pass other parameters in the same click. But you will need to make sure that the emails are going to the right individual also be careful of not using any private information in the parameters. If for example employee id is a private info at your company, consider using a request ID instead which can be mapped in your software back to the correct employee.
To add parameters to the webapp call, you just need to string them in to the end of the URL as follows:
https//webappurl?parm1=x&parm2=y&parm3=z etc..
Then in your webapp doGet code, you look up the parameter for what is passed in.
For the PDF, I do not know of a way to have the header in each page within the standard google pdf converter code. You can do your own pdf conversion code which would not be ideal as you would need to do page by page to ensure headers are in and convert the spreadsheet info into HTML then back to PDF to make it work. Perhaps someone else here might suggest an alternative.
From: google-apps-sc...@googlegroups.com <google-apps-sc...@googlegroups.com> On Behalf Of Dora Samy
Sent: September 19, 2021 1:50 PM
To: Google Apps Script Community <google-apps-sc...@googlegroups.com>
Subject: Re: [Apps-Script] Approval process through mail with a button
Hi George,
Thank you very much.
Till now i didn't know exactly how that button type is done in mail.
This helps me in a great way.
I use google drawings for inserting image and publishing it and use the pic for buttons, even though look is not great, i kind of manage.
I have one doubt. i have existing web app for staff to select the forms for getting calculation or fill the form for leave request. Same i use hide , unhide scenarios.
In this case, i have created a separate web app and as per your above function i incorporated the parameter and linked the web app in the mail template.
My doubt is it is possible to get the parameter of the existing webapp to the one created for approval or rejection.
ie.
emp id is 12345, when the staff enters in the original webapp his emp id , leave date and press request button, the mail goes for approval with a pdf leave predefined file only adding date
and emp id in that.
Now what i want is when the approval is made, it should be into the sheets with the emp id and approval. so is it possible to update the approval webapp with emp id parameter automatically like how we do in native google forms by concatenating id in the form when it is sent to the user?
is it possible?
And also one more doubt. do you have any idea of how to repeat headers in google sheets for export to pdf function.
Even after i set fzr parameter to true, the headers are not repeating.
i have a multi page pdf which is taken from sheet of dynamic items and quantities which i need add and delete rows in sheet. so it is having a chance of going into more than 1 page.
hence i want a header and footer to be set in pdf function.
i tried few options apart from using doc, but it is not yielding me results. Have you done something like this, is there any workaround possible?
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/593a1772-0fdd-4fff-bd9c-9e4c387b5713n%40googlegroups.com.
Hi George,Thanks it helped me in immense way.I have one doubt with respect to the same.. Here i am publishing the web app as for within domain users under the admin.but i need the mail has to be sent by employee mail or atleast dept head mail..What i did is, i created a sheet and based on d users i had alternated between sheet for mail -ie the data will pop into that and on edit mail will be sent from user mail.But that is failing at times.When i posted asked here about that, Alan had given me the idea regarding post load between admin and user web app by creating a separate web app for user publishing, so as to send mail. But i am not able to understand how exactly to call the email function in that. should i reference it in do post in the user web app.Do you have done something like this? any idea you can give me with respect to this..
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/8e707196-747b-4d0f-a09c-37779e82dcf0n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/f138a0cf-f5e5-47d9-ad6a-b4bcd9f02191n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/28683045-9e5b-438e-9827-5aa1b8dbbd1en%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/c564634d-82fa-4ca3-8ecd-9ba372133c88n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/8c0113dd-ceee-410c-ad60-0fe7e1e60e07n%40googlegroups.com.