Important Update: Community URLs redirect issues are partially resolved. Learn More. .

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

19 REPLIES 19

@DavidPetty 

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?

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

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&colon;GenerateMailMerge(45);"> 
<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>

I commented out the 'var templateId' since it was removed from your latest post.

Any errors being thrown in the browser console?

 Advisory Consultant

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?

@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.

It should be lower-case 'r' instead of upper-case 'R'.  I'll fix my post.

 Advisory Consultant

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

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!!

My pleasure @sness  

 Advisory Consultant