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!
|
| |
|
Re: Creating a Temp/Ad hoc group from a dataview...
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”);
|
|
|
|
Re: Creating a Temp/Ad hoc group from a dataview...
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"); |
|
|
|
Re: Creating a Temp/Ad hoc group from a dataview...
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... |
|
|
|
Re: Creating a Temp/Ad hoc group from a dataview...
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.
|
|
|
|
Re: Creating a Temp/Ad hoc group from a dataview...
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()); }
|
|
|
| |
| |
| |
| |
|
Re: Creating a Temp/Ad hoc group from a dataview...
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?
|
|
|
|