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
   Preserving Custom Roles, Secured Actions, and Assignments in Infor CRM (formerly Saleslogix) Upgrades
When upgrading between levels of Infor CRM one of the tasks that is commonly needed is to run a batch/exe
Posted on Dec 16, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Easily Showing and Hiding Tabs at Runtime in Infor CRM (Saleslogix)
Showing and hiding tabs in the Infor CRM (Saleslogix) client should be an easy thing. It should be someth
Posted on Dec 16, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Checking Infor CRM (Saleslogix) Picklists for valid data
This week I received a question about a particular picklist. One of the picklist items, when chosen, wou
Posted on Dec 05, 2014 by Dale Richter to Infor CRM Questions & Answers
 
   InforCRM (formerly SalesLogix) Web Issues with McAfee VSE 8.8 Patch 4
We have see an issue with SalesLogix v8.0 and v8.1 web clients where randomly all users are bounced due t
Posted on Dec 05, 2014 by Mark Duthoy to SalesLogix Support
 
   Avoiding the Dirty Data Message When Programatically Redirecting to a Record in Infor CRM (Saleslogix)
In my last post I wrote about using the OnClientClick property of a control (or button) to run JavaScript
Posted on Dec 02, 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