Help with Merge to Word Coding

SOLVED

Hi.

I'm using this code to display a Merge to Word button within an ASP file:

if( CRM.Mode == 2) {
if(true){
searchContainer.AddButton(CRM.Button("ButtonMailMerge", "NewDoc.gif", "javascript:document.EntryForm.TargetAction.value = 'NewWordDocument'; document.EntryForm.submit();"));
}

However, its not working quite right when it comes to storing the mail merge it within the companies' communication that follows.An unexpected event has occurred: EOleException: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

I think it has to do with the Button. But I'm not 100% sure. 
Can someone let me know if the coding above is legit for Sage CRM v2018r3?

Thanks,

Stephan

Parents
  • +1
    verified answer

    You can find example code within the XXXXXLibrary.asp page that the Advanced Customization Wizard generates.

    var caption = "FileUpload";
    // The "FILEUPLOAD" string below is NOT  a CAPTION - it is a constant to indicate to the COM object that a FILEUPLOAD button is expected
    caption = "FILEUPLOAD";
    Container.AddButton(CRM.Button(caption, "FileUpload.gif", CRM.URL(343)+"&Key-1="+iKey_CustomEntity+PersonKey+CompanyKey+OpportinityKey+HasCommunication+"&PrevCustomURL="+List.prevURL+"&E=Project"));

    Container.DisplayButton(1)=false;
    if (true){
      Container.AddButton(CRM.Button("MergeToWord", "MailMergeDOC.gif", CRM.URL(542)));
      Container.AddButton(CRM.Button("MergeToPDF", "MailMergePDF.gif", CRM.URL(6101)));
    }
  • 0 in reply to Sage CRM

    Hi Jeff,

    Is there a way to run a Mail Merge for a specific document template in an ASP page.

    The full flow would then include saving to the library and emailing this document to the Person on the record or a specific User. 

    Any guidance would be greatly appreciated!

    Stephanie

Reply Children
No Data