Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, July 5, 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!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Creating a Temp/Ad hoc group from a dataview...
Tom Smith
Posts: 13
 
Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Jul 09 9:48 AM
I have a search result dataview, and need to create a temp group. What is the best way to do this?

Thanks in advance.
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Jul 09 12:49 PM
You can create an Adhoc Group by calling the GroupBuilder.CreateAdHocGroup function. I have done this in the past.

It takes 3 parameters:
IDs: Comma Delimited list of IDs.
Family: Account/Contact/Opportunity
Name: Your Group Name


So, you could get each ID from the DataView and then call this function.
E.g.:

string conIDs = “”;
foreach(DataRowView dr in DataView.DataRows)
{
conIDs += dr[“ContactID”].ToString() + “,”;
}
conIDs = conIDs.Substring(0, conIDs.Length – 1);

string groupID = GroupBuilder.CreateAdHocGroup(conIDs, “Contact”, “My Adhoc Group”);
//Navigate to the newly created Group
Response.Redirect(“~/Contact.aspx?gid=” + groupID + “&modeid=list”);
[Reply][Quote]
Tom Smith
Posts: 13
 
Re: Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Jul 09 1:43 PM
Thanks a lot Raul!

The code works overall...just some corrections (I think anyway)

//Create adhoc group
string conIDs = "";
foreach(DataRowView dr in dv)
{
conIDs += dr["ContactID"].ToString() + ",";
}
conIDs = conIDs.Substring(0, conIDs.Length-1);

string groupID = Sage.SalesLogix.Client.GroupBuilder.GroupInfo.CreateAdHocGroup(conIDs, "Contact", "Search Group");
[Reply][Quote]
Tom Smith
Posts: 13
 
Re: Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jul 09 10:58 AM
I may have spoken too soon...

CreateAdhocGroup is giving me the error {"An error occurred creating ad hoc group. Object reference not set to an instance of an object."}
The event viewer isn't much help either.

It seems like I am calling it correctly, don't know what the problem is...
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jul 09 12:15 PM
Did you copy and paste the code?
What object is not found? The Group Info object?

If so, do you have a using for GroupBuilder?
If not, fully qualify it as:
Sage.SalesLogix.Client.GroupBuilder.GroupInfo

You don't have to create an object for this since the CreateAdHocGroup is a Static function.
[Reply][Quote]
Tom Smith
Posts: 13
 
Re: Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jul 09 12:31 PM
This is my code

using Sage.SalesLogix.Client.GroupBuilder;

//Create adhoc group
//===========================================================
string accIDs = "";

foreach(DataRowView dr in dv)
{
accIDs += dr["id"].ToString() + ",";
}

accIDs = accIDs.TrimEnd(',');

//Resulting IDs:"A6UJ9A00000O,A6UJ9A00002T,A6UJ9A00003B,A8A3TA20000C,AFP2UA100014,AYNJ4A00000S,ALOV0A000002,ALOV0A000003,AHKQCA00001N,A6UJ9A0000QN,A6UJ9A0000LI"

try
{
string groupID = GroupInfo.CreateAdHocGroup(accIDs, "account", "Search Group");
}
catch (Exception e)
{
throw new Sage.Platform.Application.ValidationException(e.ToString());
}

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jul 09 12:58 PM
The only part that I would change is passing the Family name all in upper case: ACCOUNT (or Account)

Also, is the error message on the actual call to create the group?
[Reply][Quote]
Tom Smith
Posts: 13
 
Re: Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jul 09 1:35 PM
I did that, same thing. Yes, it is on the actual call to create the group.

I'm starting to think this is caused by this form being a custom smart part...just a hunch...
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Jul 09 1:47 PM
I used this calls from an external App, and it worked fine for me.

Have you examined your exception?
Have you looked at the inner exceptions?



[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jul 09 5:21 AM
Mr. Smith,

did you get this working for you?


BTW, say hello to Mrs. Smith.

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Creating a Temp/Ad hoc group from a dataview...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jul 09 8:44 AM
Well, maybe you are correct regarding the Smart Part.

The CreateAdHocGroup method queries the GroupContext, which may not be available if you are not inheriting from the right type...
Could you make your code be a Smart Part?




[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/5/2025 2:04:14 PM