Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, June 30, 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: Group Creation from code
Tony Joanes
Posts: 71
 
Group Creation from codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 10 8:40 AM
I am creating contact adhoc groups from code.

I have a couple of problems with the groups that I create from the code. I don't seem to be able to add new contacts to the group from the UI, when selecting the option the list of groups doesn't have my newly created one in it. It also requires a logout/login for me to see the newly created group. So it appears to be a refresh issue with the new groups created but I don't seem to be able to refresh the groups.


I'm trying the refreshing using:
--------------------------------------------------
GroupContext groupContext = GroupContext.GetGroupContext();
groupContext.CurrentGroupID = id;

I'm creating the groups using the following
-----------------------------------------------------
GroupTranslator.GroupTranslatorClass gt = new GroupTranslator.GroupTranslatorClass();



try
{
// We create the new group based on the layout latest contacts group.
string templateGroupId = ConfigurationManager.AppSettings["TemplateGroupId"].ToString();
string xml = gt.GetBlankGroup("Contact", connection, templateGroupId);


System.Xml.XmlDocument document = new System.Xml.XmlDocument();
document.LoadXml(xml);

if (document.InnerText != null)
{
document.SelectSingleNode("//SLXGroup/adhocgroup").InnerText = "true";
document.SelectSingleNode("//SLXGroup/plugindata").Attributes["name"].Value = groupName;
newGroupId = gt.SaveGroup(document.OuterXml, connection);
}
}
catch (Exception ex)
{
string error = string.Format("There was an error creating the new group, please contact helpdesk: {0}", ex.Message);
throw new Exception(error);
}

[Reply][Quote]
Tony Joanes
Posts: 71
 
Re: Group Creation from codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jun 10 8:58 AM
Having some success with "currentgroupid = " seems to work when using
GroupContext.GetGroupContext().CurrentGroupInfo.ClearCache();

I have noticed that after a while you can add contacts to the groups, not sure what is refreshing this though (yet)
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Group Creation from codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jun 10 10:54 AM
Regarding the Adhoc Group issue:

Are you setting the AdhocGroupID value? (Should be the Group ID, which will be stored also under the DATACODE column on the Plugin Table.

true
p6UJ9A0005O4



[Reply][Quote]
Tony Joanes
Posts: 71
 
Re: Group Creation from codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Jun 10 10:58 AM
I've found a much better way of doing this:

I am now using this to create the new group and get an id.
string newGroupId = Sage.SalesLogix.Client.GroupBuilder.GroupInfo.CreateAdHocGroup("", "Contact", _groupName);

I then insert all the values into the adhocgroup table using a stored procedure.

This refreshing the new group and allows additions of contacts.
[Reply][Quote]
Tony Joanes
Posts: 71
 
Re: Group Creation from codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Jul 10 4:04 AM
A note for anyone else creating adhocgroups from code using the GroupInfo.CreateAdHocGroup() method;

You need a groupcontext for this to work otherwise you get and object cant be null error from the method call, you need to check for group context and if there is none then set one, I managed it like this:

GroupContext context = (HttpContext.Current != null) ? (HttpContext.Current.Session["GroupContext"] as GroupContext) : null;
if (string.IsNullOrEmpty(context.CurrentGroupID))
{
context.CurrentTable = "CONTACT";
}
[Reply][Quote]
Tony Joanes
Posts: 71
 
Re: Group Creation from codeYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Jul 10 4:11 AM
A note for anyone else creating adhocgroups from code using the GroupInfo.CreateAdHocGroup() method;

You need a groupcontext for this to work otherwise you get and object cant be null error from the method call, you need to check for group context and if there is none then set one, I managed it like this:

GroupContext context = (HttpContext.Current != null) ? (HttpContext.Current.Session["GroupContext"] as GroupContext) : null;
if (string.IsNullOrEmpty(context.CurrentGroupID))
{
context.CurrentTable = "CONTACT";
}
[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): 6/30/2025 5:12:37 AM