Subject and attachment name on Gendoc generated e-mails - Printable Version +- CoreBOSBB (https://discussions.corebos.org) +-- Forum: Support (https://discussions.corebos.org/forumdisplay.php?fid=17) +--- Forum: Modules/Extension Support (https://discussions.corebos.org/forumdisplay.php?fid=9) +--- Thread: Subject and attachment name on Gendoc generated e-mails (/showthread.php?tid=2130) |
Subject and attachment name on Gendoc generated e-mails - radu - 03-19-2021 Hello, Is there a way to change gendoc's default behavior for generating e-mails: 1. I want the e-mail subject to be the same as the entity subject(i work on Quotes but i gues it would be more or less the same for SO, INV, PO since they all have subject) by default - i figured i could use the field set mapping but i really don't know what would be the source and destination in this case. 2. I want the name of the attached document to be the entity subject(Quote subject in this case) - i mingled a bit with evvtgendoc.js and i noticed that i can alter the name in this variable: var emailurl = 'index.php?module=Emails&action=EmailsAjax&file=EditView&attachment='+i18n+'_'+crmid+'.'+(format=='pdf' ? 'pdf' : 'odt'); but i don't know how to construct it properly. Saving to folder and exporting is doing that by default and I would like send e-mail to behave the same Any help is appreciated. Thanks RE: Subject and attachment name on Gendoc generated e-mails - joebordes - 03-19-2021 1.- you can use all the same variables you use in the body of the email in the subject, so you can set the email subject field to something like $subject 2.- have you tried with the global variable Workflow_Email_GenDoc_Attachment_Name ? RE: Subject and attachment name on Gendoc generated e-mails - radu - 03-20-2021 (03-19-2021, 08:59 PM)joebordes Wrote: 1.- you can use all the same variables you use in the body of the email in the subject, so you can set the email subject field to something like $subject 1. - I tried it on the online demo and is not working for Quotes (or I'm not doing it right). It works for contacts but it will not replace the variables for quotes. I left there a message template called Quote Template. 2.- I did not noticed that GV(again) . However it does not seem to work. I left glb-0000019 on the online demo. Thanks RE: Subject and attachment name on Gendoc generated e-mails - joebordes - 03-20-2021 I don't know how you are testing in the demo as the workflow emails are not being sent from there nor is GenDoc installed, so you shouldn't be able to test these two things there Give me some more information RE: Subject and attachment name on Gendoc generated e-mails - radu - 03-20-2021 (03-20-2021, 10:03 AM)joebordes Wrote: I don't know how you are testing in the demo as the workflow emails are not being sent from there nor is GenDoc installed, so you shouldn't be able to test these two things there here is the link: https://demo.corebos.com/index.php?module=Contacts&parenttab=ptab&action=DetailView&record=43721 I setup GV glb-0000019 with the value Name Gendoc seems installed, just not prepared for pdfs. I created a contact(gendoc was already activated on contacts, I activated it also on quotes and duplicated the contact template i found there, setting it to be applied on quotes. It doesn't matter if it generates a good file, i'm just checking to see what it wants to attach before sending). I also created a message template(nr. 43723), i tested it with contacts and some field from there, I could set the e-mail subject. Later I modified it for quotes and tried with subject. It did not work, you can check it out. the variable is not parsed i just get '$subject' string. I do not need to actually send the mail, i'm just looking at what it composed when I click 'E-mail Document' from gendoc's widget. I should see the template being aplied there if I select it. I mean it works for Contacts. The generated document that is already attached is always module_name+crmid no matter of the module and that GV. The name of the attached document does not change for neither contacts or quotes Did I do it wrong? RE: Subject and attachment name on Gendoc generated e-mails - joebordes - 03-21-2021 No, you did it correctly, I didn't understand. I looked into it and remembered that this is how it works. You are sending the email to the account/contact and only that module is supported for merging variables. This comes all the way back from vtiger crm where it was hard to do the merge for other modules. In coreBOS the email module has support for a Merge_Template_With list of IDs that will get their variables merged. So I added the quote (and other inventory modules) to that variable and it seems to be working. Update and give it a try. Workflow_Email_GenDoc_Attachment_Name only applies to workflows, that is why there is no change in the template name To make the change of the name you have to pass the subject to gendocAction() so you can substitute the crmid in the line you set in red above and then you have to apply this change in the GenDoc module Code: diff --git a/modules/evvtgendoc/gendocAction.php b/modules/evvtgendoc/gendocAction.php you have to be sure to generate the same name in javascript and PHP. The hard part is getting the information you want in the gendocaction call. I would prefer to use a business map to define how the name should be generated, but that is not a trivial task. Let me know how it goes RE: Subject and attachment name on Gendoc generated e-mails - radu - 04-07-2021 (03-21-2021, 12:27 AM)joebordes Wrote: No, you did it correctly, I didn't understand. Hello, sorry for the delay. I can confirm that fields from inventory modules are available for the template. I have a further question: how do I apply a default e-mail template when generating e-mails with gendoc widget? I tried the GV Users_Default_Send_Email_Template but it does not load the specified template, user has to select it. For the name of the attachment i don't know how to get it. I tried to include something like this: Code: var nm1 = document.getElementById('mouseArea_quote_no').value; RE: Subject and attachment name on Gendoc generated e-mails - joebordes - 04-11-2021 I fixed the default template in inventory emails, update and give it a try. as to the gendoc name, as I said above it is non-trivial, send me an email and I will get it done for you |