Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, July 8, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Group of contacts that have not been contacted in the last 90 days
SLX_Novice
Posts: 246
 
Group of contacts that have not been contacted in the last 90 daysYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Feb 10 8:12 AM
Hi all.

We have SLX LAN v7.2.1 and we would like to create a contacts group that shows contacts that have not been contacted (i.e. no phone call, email or note) within the past 90 days.

I tried using the query builder but I don't see how I can get this to work.

Any ideas?

Thank you in advance.
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Group of contacts that have not been contacted in the last 90 daysYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Feb 10 10:05 AM
This is harder than you would expect.

The trick is to find a way to use the IN operator in the group definition - because only then can you write some freehand SQL, which is what you need to solve this problem.

First you need a query which will return a list of all ContactIDs which have no HISTORY record with a completed date in the last three months (database changes excluded). Use a correlated subquery:


select C.ContactID from Contact C where not Exists (
select Distinct H.ContactID from history H
where H.CompletedDate > DateAdd(m, -3, getutcdate()) and H.ContactID = C.ContactID and H.Type <> 262156
)


Now create yourself a Contact group. In the conditions bit, add Contact.ContactID and set the operator to IN, and paste the above query in.


[Reply][Quote]
SLX_Novice
Posts: 246
 
Re: Group of contacts that have not been contacted in the last 90 daysYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Feb 10 12:40 PM
Thanks for the reply Phil.

I opened query builder and selected Contact.ContactID and set the operator to IN and pasted the following in the "Value is:" box:

select A1.ContactID from Contact A1 where not Exists (select Distinct H.ContactID from history Hwhere H.CompletedDate > DateAdd(m, -3, getutcdate()) and H.ContactID = A1.ContactID and H.Type <> 262156)

But when I click OK to see the results nothing displays. Here is what appears in the SQL when I click the "View SQL" button:

SELECT A1.CONTACTID, A1.FIRSTNAME, A1.LASTNAME, A1.ACCOUNT, A2.CITY A2_CITY, A2.STATE A2_STATE, A1.WORKPHONE, A1.MOBILE, A1.EMAIL FROM CONTACT A1 INNER JOIN ADDRESS A2 ON (A1.ADDRESSID=A2.ADDRESSID) WHERE (A1.CONTACTID IN (select A1.ContactID from Contact A1 where not Exists (select Distinct H.ContactID from history H where H.CompletedDate > DateAdd(m, -3, getutcdate()) and H.ContactID = A1.ContactID and H.Type <> 262156)))

[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Group of contacts that have not been contacted in the last 90 daysYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Feb 10 12:51 PM
The table aliases are getting confused - too many A1's, so I suggest that you do not use A1 in the bit that you paste. Instead try pasting exactly what appears on my first post.

[Reply][Quote]
SLX_Novice
Posts: 246
 
Re: Group of contacts that have not been contacted in the last 90 daysYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Feb 10 12:55 PM
Still no results. Here's the SQL code:

SELECT A1.CONTACTID, A1.FIRSTNAME, A1.LASTNAME, A1.ACCOUNT FROM CONTACT A1 WHERE (A1.CONTACTID IN (select C.ContactID from Contact C where not Exists (select Distinct H.ContactID from history H where H.CompletedDate > DateAdd(m, -3, getutcdate()) and H.ContactID = C.ContactID and H.Type <> 262156)))
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Group of contacts that have not been contacted in the last 90 daysYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Feb 10 1:06 PM
That code seems to work for me.

Can you try running it in SQL Server Management Studio (logged in as sysdba) and see whether that works?
[Reply][Quote]
SLX_Novice
Posts: 246
 
Re: Group of contacts that have not been contacted in the last 90 daysYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Feb 10 9:01 AM
Hi Phil.

I ran it in SQL Query Analyzer and it worked fine. But for some reason in SalesLogix it doesn't.
[Reply][Quote]
SLX_Novice
Posts: 246
 
Re: Group of contacts that have not been contacted in the last 90 daysYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Feb 10 9:05 AM
Nevermind, it works Phil. I had to do a "Refresh All".

Thanks for your help!
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 7/8/2025 9:51:06 AM