08-06-2010 11:53 AM
I'm trying to perform a mail merge to opportunity fields. In SLX Windows, I modified the VBScript Mail Merge OnCustomFieldName script to assist with this. In Web, it's requesting I do the same thing when I try to merge a template. I found the VBS file that it references but I don't know how to perform a lookup in VBS code so that I can get the value. Has anyone else run into this or know how to perform a lookup from there?
08-09-2010 05:55 AM
What do you mean with lookup?
The scripts for web and LAN work the same, so everything you do in the mail merge script in the LAN can be done in the web.
Keep in mind that in version 7.5.3 you will have a java script for the web version.
08-09-2010 06:12 AM
When I refer to "lookup", I am referring to how we query the SQL database in the original Architect. In the original Architect, I was using the objDB = New SLX_DB, objDB.GetNewRecordSet code. I don't believe that this works in the Web version (maybe I'm wrong?). So I'm looking for a way to query the database. I have the OpportunityID and field name that I am looking for, I just need to know how to run a query.
01-20-2012 03:07 AM - edited 01-20-2012 03:07 AM
I think I found it.
Seems to me it's sage-mailmerge-service.js (SLXClient\jscript)
I will try the function "HandleOnCustomFieldName" now - let's see.
01-20-2012 03:57 PM
01-24-2012 12:10 AM
I think I need some help again.
I added a handling for my custom field to "sage-mailmerge-service.js" to the "HandleOnCustomFieldName" function.
This field is added to the mailmerge templates, name spelling is correct.
When I now call the mailmerge document, I receive the folloging error message:
"The Mail Merge Engine encountered an error and cannot continue. There was an error processing the "Custom_Test" SLXSPECIAL_CUSTOM field. This field must be processed in a customized VBScript by the Sales Client. Please report this error to your SalesLogix Administrator: The custom merge field could not be processed because it was not handled in the OnCustomFieldName event."
01-24-2012 05:12 AM
Hi. I think you need to re-build the sage-mailmerge.js file using js builder and the coresponding jsb file.
If you take a look at sage-mailmerge.js you will see that your custom field is not in there.
Just build the file and put it in the folder where the current file is in.
01-24-2012 06:49 AM - edited 01-24-2012 06:50 AM
Yes, as Alexander noted below, you will have to rebuild sage-mailmerge.js. In addition, you can ignore the error message text in regard to MailMerge.vbs; the error message was not updated; this is a bug.
I've extracted the instructions for rebuilding sage-mailmerge.js from the "Applying Service Pack 3 for Sage SalesLogix Version 7.5".pdf.
Customizing the sage-mailmerge.js
If you have customized the MailMerge.vbs, any customizations that reference the original CreateObject calls must be replaced with the new Mail Merge API. The functionality formerly in the MailMerge.vbs script has been moved into sage-mailmerge-service.js and sage-mailmerge-loader.js.
The source files included in the SageMailMerge.jsb JS Builder Project are:
• SlxClient\jscript\sage-mailmerge\ sage-mailmerge-service.js
• SlxClient\jscript\sage-mailmerge\ sage-mailmerge-context.js
2. Add sage-mailmerge-overrides.js to the existing SageMailMerge.jsb JS Builder Project file and save the project.
3. In JS Builder, open the Build Settings tab.
4. In the Combine compressed files to create specific output files section, select Sage Mail Merge, and then click Edit.
5. In the Output Target Properties dialog box, drag the sage-mailmerge-overrides.js from the list of Project Files to the bottom of the list of Included Files.
6. Click OK.
7. Rebuild the SageMailMerge.jsb in JS Builder.
You will want to copy the Sage.MailMergeService.prototype.HandleOnCustomFieldName function into your new sage-mailmerge-overrides.js and then follow the instructions above.
01-25-2012 04:51 AM
Now, I created a new file "sage-mailmerge-overrides.js" and copied the HandleOnCustomFieldName function into it, including my new customfield handling.
I did a rebuild via the js builder and when I have a look at sage-mailmerge.js, I find the new code merged into it.
After this a did a deploy (checking the sage-mailmerge.js in the wwwroot folder and finding my customized code again in it), but unfortunatly, I still receive an error that my custom field is not treated in the respective script.
When I include "CUSTOMFIELDNAME_EXAMPLE_A" custom field in the template, everything works fine.
What am I doing wrong?