You need to sign in to do that
Don't have an account?
phil7s
Automated Mail Merge
Greetings,
Has anyone seen any reference in Salesforce on how to automate a mail merge, or succesfully coded this? For example, on creation of an object, I would like to automatically create a document containing record information.
I know I can code this on our back end through vb.net and then post that doc to SF as an attachment....just wondering what can be done in Salesforce either through the Web API, Workflow, etc.
Any help is appreciated!
Thanks,
Phillip
do you have any specific links? I've searched though SFDC (help training, wiki, ideas, discussions) the past couple of days and I havent found anything on "automated" mail merge......we currently do manual mail merges.
Thanks for the reply.
Have you looked on the AppExchange at products like CongaMerge? I think there are actually a few products already available which may do what you're looking for.
yea I have, will probably look at them more in depth............i'm just a stickler for doing it myself if I can!
thanks for your feedback and info.
If workflow can give you script control with the context of the record you want to use for the dataset, you can automate mail merge.
This is a snip from /mail/mmgen.jsp in the sfdc app:
var mainId //main data id
var cid //primary contact. can be null
var did //templateid
var newMM = new ActiveXObject('AppExchangeMailMerge.MMHost.1')
var gackUrl = '/servlet/servlet.GackSender'
var gackList = 'gack@salesforce.com'
/*
Setup for standard date based merge that shows the unsaved results
*/
newMM.GenMailMerge(
'433400D00000000hilP!AQsAQL7wRpF.BqG3w0wulRdf.nLctVZtdGoJGEOsJf.jhrtK9CaZXV3BkZjXB1.2GiTcoTcyaaNPgVLiHYjX9QoYY4oi4CUg',
'https://ssl.salesforce.com',
mainId,
cid,
did,
gackUrl,
gackList,
false
)
I almost get that but not quite. Is that some Javascript you've specified there which might run in the context of an Scontrol?
Yup, this is javascript that will run in an scontrol (same script that runs when you click mail merge in the app, unless you are using serverside mailmerge?).
You need to supply:
a sid
id of "main" record to use for the merge
id of a contact to use (if you want)
id of the merge template
for the rest of the parms use the same values as the example.
btw, this script does not install the control, though you could do that if you need to.
Hi, foghorn... I need your help.
I am trying to use your code and receive a funky error I cannot debug - CMMHost::DownloadData:Exception... Do you know what this means?
An internal server error has occured while processing your request.
Url:https://ssl/salesforce.com/servlet/servlet.SForceMailMerge?
id=0060000009ttAg&did=01H60000000EEYC
Save to file name:C:\Documents and Settings\bobby\Application
Data\salesforce.com\OfficeToolkit\download\mergeData.xml
An internal server error has occured while processing your request.
Url:https://ssl.salesforce.com/servlet/servlet.GackSender?
recipient=gack@salesforce.com&subject=Mail%20merge%
20gack@body=cmm.host::DownloadData:Exception%0AAn%20internal%
20server%20error%20has%20occured%20while%20processing%20your%
20request.%0AUrl:https:%2F%2Fssl.salesforce.com%2Fservlet%
2Fservlet.SForceMailMerge?
id=00660000009ttAg&did=01H60000000EEYC
Save to file name:C:\Documents and Settings\bobby\Application
Data\salesforce.com\OfficeToolkit\download\mergeData.xml
%0AIE%20version:7.0.6000%AWord%20version:10.0.2627%
0AMSXML%20version:MSXML2.DOMDocument.4.0%0AVB%
20runtime%20versions:%0Amsvbvm50.dll:4.2.44%
0Amsvbvm60.dll:6.0.90
Save to file name:C:\Documents and Settings\bobby\Application
Data\salesforce.com\OfficeToolkit\download\mergeData.xml
<html>
<head>
<script>
function go()
{
try
{
//login to get sid and serverurl
var sfApi = new ActiveXObject("SForceOfficeToolkit3.SForceSession3")
if(!sfApi.Login(un.value,pw.value))
{
alert(sfApi.ErrorMessage)
return
}
var mainId = '00600000007m5Ki' //main data id
var cid = '' //primary contact. can be null
var did ='01H000000000CQQ' //templateid
var newMM = new ActiveXObject('AppExchangeMailMerge.MMHost.1')
var gackUrl = '/servlet/servlet.GackSender'
var gackList = 'gack@salesforce.com'
//get url to use, notice no trailing '/'
var i = sfApi.ServerUrl.indexOf('.com')
var serverUrl = sfApi.ServerUrl.substring(0,i + 4)
newMM.GenMailMerge(
sfApi.SessionId,
serverUrl,
mainId,
cid,
did,
gackUrl,
gackList,
false
)
}
catch(exp)
{
alert(exp.description)
}
}
</script>
</head>
<body>
username <input type=text name=un ><br>
password <input type=text name=pw ><br>
<input type=button onclick=go() value="Go">
</html>
Hi,
Your code is really helpful using that i have generated the mailm merge document.
My requirement is i need to capture that generated document and send it by Email as an atacment.
Can u plz help me on this?
Thanks in advance!!!!!!!
http://boards.developerforce.com/t5/Visualforce-Development/render-VF-page-as-word-document/td-p/152538
Tip: You can save/email the vf page by writing code in your controller