Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
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
2021-12-27 11:51 AM - edited 2022-01-05 08:44 AM
@sness, here's the custom object. Just update the variables accordingly. For the moduleName variable, use the plus (+) sign for spaces.
<div class="workflow-app-buttons" id="wftran1998:CUST">
<a title="Mail Merge" class="tb-btn-link-left" id="btnPerformMailMerge" href="javascript:void(0);">
<div class="tb-btn " data-icon="" data-icon-pos="left"> Mail Merge Button Text Here</div>
</a>
</div>
<script type="text/javascript">
var contentId = getRecordId();
var levelId = 218;
var moduleName = 'PCI+Project';
var templateId = 3;
$('#btnPerformMailMerge').click(function() {
ShowExportReportCreationWindow('/GenericContent/ExportReportCreation.aspx?contentId=' + contentId + '&levelId=' + levelId + '&exportSourceType=RecordView&exportType=Rtf&moduleName=' + moduleName.replace(' ','+') + '&templateId=' + templateId + '&et=0','Export');
});
</script>
Advisory Consultant
2021-12-23 11:41 AM
@sness, yes it can be done via a custom object. I’ll post it next week after vacation
Advisory Consultant
2021-12-27 11:51 AM - edited 2022-01-05 08:44 AM
@sness, here's the custom object. Just update the variables accordingly. For the moduleName variable, use the plus (+) sign for spaces.
<div class="workflow-app-buttons" id="wftran1998:CUST">
<a title="Mail Merge" class="tb-btn-link-left" id="btnPerformMailMerge" href="javascript:void(0);">
<div class="tb-btn " data-icon="" data-icon-pos="left"> Mail Merge Button Text Here</div>
</a>
</div>
<script type="text/javascript">
var contentId = getRecordId();
var levelId = 218;
var moduleName = 'PCI+Project';
var templateId = 3;
$('#btnPerformMailMerge').click(function() {
ShowExportReportCreationWindow('/GenericContent/ExportReportCreation.aspx?contentId=' + contentId + '&levelId=' + levelId + '&exportSourceType=RecordView&exportType=Rtf&moduleName=' + moduleName.replace(' ','+') + '&templateId=' + templateId + '&et=0','Export');
});
</script>
Advisory Consultant
2022-01-03 11:14 AM
David - I'm not able to get this working. When clicking on the button, nothing happens. No errors, just no action. If it matters, this is on 6.9 P3. Here is my code -
<div class="workflow-app-buttons" id="wftran1998:CUST">
<a title="Mail Merge" class="tb-btn-link-left" id="btnPerformMailMerge" href="javascript:void(0);">
<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 = 256;
var moduleName = 'System';
var templateId = 37;
$('#btnPerformMailMerge').click(function() {
ShowExportReportCreationWindow('/GenericContent/ExportReportCreation.aspx?contentId=' + contentId + '&levelId=' + levelId + '&exportSourceType=RecordView&exportType=Rtf&moduleName=' + moduleName.Replace(' ','+') + '&templateId=' + templateId + '&et=0','Export');
});
</script>
I have confirmed that the values for level and template IDs are correct. Does it matter for the layout tab? Only ask because I saw this in the HTML element - moduleName%3dSystem%26templateId%3d37%26layoutId%3d545
2022-01-03 01:49 PM
@sness, if the code is in the tab, that could be the problem.
Put the custom object outside the tab set and see if works or not.
Advisory Consultant
2022-01-03 03:43 PM
Does it make sense that this works if only 1 custom object is on the layout? When I add a second item that is using a different template ID, it does not work. If I remove 1 of them, then the remaining object works as expected. If there are 2 custom objects, only the item listed first works. Also tried to place each custom object in a separate section, but no change.
Basically, I have 4 mail merge templates associated with the same application and was hoping to have one of these custom objects for each template.
Thanks
2022-01-03 03:56 PM - edited 2022-01-05 08:45 AM
The custom object would have to be changed a bit to be a little bit more dynamic.
Now, I'm passing the template id (second line) to a new function called GenerateMailMerge([template id]);
<div class="workflow-app-buttons" id="wftran1998:CUST">
<a title="Mail Merge" class="tb-btn-link-left" id="btnPerformMailMerge" href="javascript:GenerateMailMerge(1);">
<div class="tb-btn " data-icon="" data-icon-pos="left"> Mail Merge Button Text Here</div>
</a>
</div>
<script type="text/javascript">
var contentId = getRecordId();
var levelId = 218;
var moduleName = 'PCI+Project';
function GenerateMailMerge(templateId) {
ShowExportReportCreationWindow('/GenericContent/ExportReportCreation.aspx?contentId=' + contentId + '&levelId=' + levelId + '&exportSourceType=RecordView&exportType=Rtf&moduleName=' + moduleName.replace(' ','+') + '&templateId=' + templateId + '&et=0','Export');
}
</script>
Then just duplicate below and change the template id being passed and the text for each button.
<div class="workflow-app-buttons" id="wftran1998:CUST">
<a title="Mail Merge" class="tb-btn-link-left" id="btnPerformMailMerge" href="javascript:GenerateMailMerge(2);">
<div class="tb-btn " data-icon="" data-icon-pos="left"> Template 2</div>
</a>
</div>
Advisory Consultant
2022-01-03 05:09 PM
In the response you have -
var contentId = 205570
But I assume that should still be -
var contentId = getRecordId()
Is this the correct syntax -
<div class="workflow-app-buttons" id="wftran1998:CUST"> <a title="Mail Merge" class="tb-btn-link-left" id="btnPerformMailMerge" href="javascript:GenerateMailMerge(1);">
<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>
2022-01-04 07:56 AM
Correct, I've updated my post with the correction.
Advisory Consultant