<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Efficy Overflow Q&amp;A - Recent questions tagged mergetemplate</title>
<link>https://overflow.efficy.io/?qa=tag/mergetemplate</link>
<description>Powered by Question2Answer</description>
<item>
<title>multiple mail template using a document template</title>
<link>https://overflow.efficy.io/?qa=3545/multiple-mail-template-using-a-document-template</link>
<description>&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;I want to add a button on Project which have to send mail to all contacts linked to the project.&lt;br&gt;
I know how to create the button but the mail will use a Mail Template to generate the mail body, and each mail have to contain an attachment, this attachment come from a Document Template.&lt;/p&gt;

&lt;p&gt;I think my script have to :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get the ntCont detail dataset of the Project and loop on it&lt;/li&gt;
&lt;li&gt;For each Contact&lt;br&gt;
2.1 merge the Word/PDF Template&lt;br&gt;
2.2 merge the Mail Template&lt;br&gt;
2.3 Link the both&lt;br&gt;
2.4 Send the mail with &quot;SendExternalMail&quot; ?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I have some questions :&lt;br&gt;
&lt;strong&gt;Can I send all the mail with only one call ? (after the loop ?)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Questions for the Word/PDF Template :&lt;br&gt;
The function will be call on the Project consult view.&lt;br&gt;
My function will get the Contacts detail dataset and launch the Template for each of them. In this template I use these macro :&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;[$=COMP.NAME]  --&amp;gt; need the Main Company NAME of the Contact&lt;br&gt;
  [$=CONT.NAME]  --&amp;gt; need the current Contact name&lt;br&gt;
  [$=OPPO.NAME] --&amp;gt; need the Main Opportunity name of the project&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;How can I get all of these data ? If I call &lt;em&gt;MergeTemplate&lt;/em&gt; with the Contact Edit Context, I think CONT.NAME and COMP.NAME will be good, but I don't think the OPPO.NAME will be the good one : Efficy will take the main oppo of the contact, and not of the project.&lt;br&gt;
&lt;strong&gt;I think I can get this name before and pass it as argument it to the template (param of &lt;em&gt;MergeTemplate&lt;/em&gt;), how to use it in the template ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;SendExternalMail&lt;/em&gt; don't specify how to join a file, have I just to link the mail to the ntFile ?&lt;/strong&gt;&lt;/p&gt;
</description>
<category>WorkFlow / Serverscript</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3545/multiple-mail-template-using-a-document-template</guid>
<pubDate>Fri, 14 Sep 2018 08:01:13 +0000</pubDate>
</item>
</channel>
</rss>