Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

Opening up a world of possibilities with SalesLogix mail merge documents- Using SQL functions

I just came up with a really cool way of doing some potentially really cool and complicated things from with the SalesLogix Word Mail Merge engine utilizing a combination of SQL merge fields and SQL functions.

The beauty of the SQL function is that it could potentially do some really powerful things, like querying an external data source or doing powerful calculations that could not otherwise be achieved in the SalesLogix mail merge.

Lets take a look at a real simple example that should explain what I am talking about.

The first step is to create a SQL function.  In my demo I am just going to return the SalesLogix account name with “FX” prepended.  My function will pass in one variable (the accountid of the account I want to return my special formatted account) and return a string (of my special formatted account name).  Here it is:

Create function [sysdba].[FXAccount](@Accountid varchar(12))
returns varchar(100) as
begin

Declare    @Account varchar(100)
Declare    @TempString varchar(100)

select    @Account = isnull(account,'') from account where accountid = @Accountid
set @TempString = 'FX' + @Account

Return @TempString
end

Take note that I created the function under the sysdba user. Now with that created, I can use it in a mail merge.

When in the SalesLogix mail merge, click the Insert Special Field button on the Word toolbar, then choose SQL…Text.

 

SQL Mail Merge field

 

Name you field in the Field Identifier, in the screen shot above I have it set to “Custom Username”.  Click the Ellipse in the SQL box.  This will open the SQL dialog:

SQL Mail Merge SQL

Now type in your SQL query that utilizes the SQL function you had built.  It is important to prefix your function with sysdba again.  Note that the mail merge queries also need to have a reference to the record the query is being run against.  This is done via the Insert Parameter button on the toolbar.  In my case I am running this query against the current merge record’s account, represented by :AccountID.


That is all there is to it.

I think it is pretty cool.

BTW, this same approach could be used in queries from the SalesLogix client, either web or LAN based via calls through the SalesLogix OLEDB Provider using ADO.
What's This?
  
Bookmark and Share

About Kris Halsrud

   Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.


Related Content
   Saleslogix XBar Installation
When installing the new XBar application I found the instructions a little vague so I thought I would pas
Posted on Jul 18, 2014 by Mark Duthoy to SalesLogix Support
 
   "Saleslogix’s affordable pricing and usability allow the product to rise above competitors in the space" - Info-Tech Research Group, Inc.
"SalesLogix’s affordable pricing and usability allow the product to rise above competitors in the sp
Posted on Jul 14, 2014 by Scott Weber to SalesLogix Product Blog
 
   Saleslogix Default Group Layout
How can I default the formatting of columns in my Saleslogix groups?
Posted on Jul 03, 2014 by Dale Richter to SalesLogix Questions & Answers
 
   Changing Contact Process Statuses in Bulk
Recently, I was asked if it was possible to cancel a group of running contact processes.The answer is yes
Posted on Jun 30, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Finding the Current Parent Record ID in SalesLogix Web
Sometimes it's the easiest things that can be a big barrier to entry for getting started with somet
Posted on Jun 27, 2014 by Ryan Farley to Ryan Farley's Blog
 
Comments

 

Twitter Trackbacks for Opening up a world of possibilities with SalesLogix mail merge documents- Using SQL functions - Kris Halsrud's Blog [customerfx.com] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 Opening up a world of possibilities with SalesLogix mail merge documents- Using SQL functions - Kris Halsrud's Blog         [customerfx.com]        on Topsy.com

June 22, 2010 4:27 PM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2014 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register