Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Contributor
Posts: 15
Registered: ‎11-20-2009

Creating a group via code in 7.5.2 web

Hello. We have a custom search screen and need to be able to create a group for the current user by passing in the conditions of the current search on a form. Any ideas how this can be accomplished?

 

Thanks in advance.

 

Allen

Tuned Listener
Posts: 2
Registered: ‎09-23-2009

Re: Creating a group via code in 7.5.2 web

Hi Allen,

 

Hope this helps, I used this code to create an ad-hoc group from a string of comma separated contact Ids which I had collected through another bit of code.

 

 

        Sage.SalesLogix.Client.GroupBuilder.GroupInfo.CreateAdHocGroup(Ids, "Contact", groupName);

The properties:

 

Ids = string of Contact Ids

groupName = string, what you want to call your group  

 

Thanks

 

Jason

Copper Contributor
Posts: 15
Registered: ‎11-20-2009

Re: Creating a group via code in 7.5.2 web

Thanks Jason. I need to store the conditions though,not the values because this group has to dynamically display any new records that match the criteria. With the CreateAdHocGroup method i believe it will only store the current list of IDs and will be a static group.

 

Is there a way to pass the (SQL) conditions to the group builder via the group builder ?

 

 

Bronze Super Contributor
Posts: 204
Registered: ‎03-10-2009

Re: Creating a group via code in 7.5.2 web

Allen, dev was kind enough to offer this suggestion....

 

There is nothing in place that will take a SQL statement and create a group from it.  “Groups” are metadata that build SQL statements and there isn’t anything in place to go the other direction.  But, if you can provide the correct metadata, then you can create a new group.  Since you are building the sql from the custom lookup, I assume you’ll probably have all the correct metadata. There are a couple of options I would suggest.  One, is to do it like the lookup button on the list views.  It puts the user’s conditions into the special “Lookup Results” group, then there is an option on the lookup results group to “save lookup as group”.   They may be able to tie into the lookup results group and do the same thing – however, I’m not sure what control they want on the layout of these new groups.  The layout of the lookup results group can be different for each user because they can change it. The way you’ll probably want to do it is like what we do in the group builder UI.  In the dialog for creating a new group, a group XML block is created and sent to the server to save as a new group.  It is almost entirely in JavaScript, so the code is available for you to debug through.  (However, I must warn you, that code is quite messy and hard to follow – but it does show how you can accomplish the task at hand)  I don’t remember the exact syntax, but there is a way to get a “blank” group XML.  This is one with the “default” layout and no conditions.  They can just take that and add the conditions, then post that to the server.  Or if they want a certain “layout” then they can just create a specific starting group XML. 

 


Sr. Sales Engineer
Gene Arnold
Copper Contributor
Posts: 15
Registered: ‎11-20-2009

Re: Creating a group via code in 7.5.2 web

Thanks Gene! I appreciate the info from dev.

Would you be able to point me to which file contains the group builder code that is being referred to ? I am not sure where to look.

Bronze Super Contributor
Posts: 204
Registered: ‎03-10-2009

Re: Creating a group via code in 7.5.2 web

I'm going to say they are the files in this directory...

 

C:\Inetpub\wwwroot\SlxClient\GroupBuilder


Sr. Sales Engineer
Gene Arnold