2021-12-23 09:13 AM
Is it possible to have a custom object that will select a specific mail merge template for export? I can display the Export button (master_btnExport), but was hoping to expand on the function to make it easier for end user as we have a dozen or so templates.
TIA
2022-01-04 08:37 AM
I'm still missing something as neither objects are working. How is the value for the template ID getting passed to the function as part of the 'ShowExport...' action?
2022-01-04 08:55 AM
In the HTML that creates the button, the href has javascript:GenerateMailMerge([template id]); The [template id] would be replaced with the actual mail merge template id like, GenerateMailMerge(15);
Advisory Consultant
2022-01-04 09:06 AM
Afraid that's not working. Still getting no response when clicking on the object.
<div class="workflow-app-buttons" id="wftran1998:CUST"> <a title="Mail Merge" class="tb-btn-link-left" id="btnPerformMailMerge" href="javascript:GenerateMailMerge(45);">
<div class="tb-btn " data-icon="" data-icon-pos="left">Generate SSP All Controls</div>
</a>
</div>
<script type="text/javascript">
var contentId = getRecordId();
var levelId = 268;
var moduleName = 'System';
//var templateId = 45;
function GenerateMailMerge(templateId) {
ShowExportReportCreationWindow('/GenericContent/ExportReportCreation.aspx?contentId=' + contentId + '&levelId=' + levelId + '&exportSourceType=RecordView&exportType=Rtf&moduleName=' + moduleName.Replace(' ','+') + '&templateId=' + templateId + '&et=0','Export');
};
</script>
I commented out the 'var templateId' since it was removed from your latest post.
2022-01-04 09:11 AM
Any errors being thrown in the browser console?
Advisory Consultant
2022-01-04 09:27 AM
Yes, I was getting -
moduleName.Replace is not a function at GenerateMailMerge
So I updated to remove '.Replace(' ','+')' after moduleName and it is working with multiple objects on the layout. The current application name is a single word, do I need to worry when applying to this to an application with more than 1 word?
2022-01-04 11:29 AM
@DavidPetty do you think there is any way for this to work with the object on a tab set? It does work with 3 objects on a section, but it makes the UI a little messy.
2022-01-05 08:41 AM
It should be lower-case 'r' instead of upper-case 'R'. I'll fix my post.
Advisory Consultant
2022-01-05 08:43 AM
Try putting the <script>...</script> lines in a custom object outside of the tab set and put the <div></div> lines in a custom object inside of the tabs.
Advisory Consultant
2022-01-05 12:22 PM
This seems to be working. I have just 1 CO that is outside the tab set with the <script>, and then 3 CO's inside the tab set that specify the mail merge template ID.
Thanks again for all the support!!
2022-01-05 03:56 PM - edited 2022-01-05 03:56 PM
My pleasure @sness
Advisory Consultant