cancel
Showing results for 
Search instead for 
Did you mean: 

Custom object to select specific mail merge object

sness
Contributor III

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

1 ACCEPTED SOLUTION

Accepted Solutions

DavidPetty
Archer Employee
Archer Employee

@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&colon;void(0);">
             <div class="tb-btn " data-icon="&#xE071" 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 - Archer, an RSA Business

View solution in original post

19 REPLIES 19

DavidPetty
Archer Employee
Archer Employee

@sness, yes it can be done via a custom object.  I’ll post it next week after vacation

 Advisory Consultant - Archer, an RSA Business

DavidPetty
Archer Employee
Archer Employee

@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&colon;void(0);">
             <div class="tb-btn " data-icon="&#xE071" 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 - Archer, an RSA Business

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&colon;void(0);"> 
		<div class="tb-btn " data-icon="&#xE071" 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

@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 - Archer, an RSA Business

@DavidPetty - that does work!

Thanks

@DavidPetty 

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

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&colon;GenerateMailMerge(1);">
             <div class="tb-btn " data-icon="&#xE071" 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&colon;GenerateMailMerge(2);">
             <div class="tb-btn " data-icon="&#xE071" data-icon-pos="left">  Template 2</div>
     </a>
</div>

 

 

 

 

 Advisory Consultant - Archer, an RSA Business

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&colon;GenerateMailMerge(1);"> 
<div class="tb-btn " data-icon="&#xE071" 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>

 

Correct,  I've updated my post with the correction.

 Advisory Consultant - Archer, an RSA Business