Showing results for 
Search instead for 
Do you mean 

Problem getting GroupList from Opportunity

Copper Contributor
Posts: 123
Country: Canada

Problem getting GroupList from Opportunity

[ Edited ]

Hey I'm not sure if I'm doing something wrong or if this is just an issue with the SDK but I am trying to get a GroupList from an Opportunity and I keep getting an exception.

Here's the code I'm using:

GroupFieldDescriptor gField = tool.ActFwk.Groups.GetGroupFieldDescriptor("Group_Name", FieldNameType.Alias);
SortCriteria[] sCrit = new SortCriteria[] { new SortCriteria(gField, ListSortDirection.Ascending)};
OpportunityList oL = tool.ActFwk.Opportunities.GetOpportunities(null); Opportunity o; GroupList gL; for (int i = 0; i < oL.Count; i++) { o = oL[i]; gL = tool.ActFwk.Groups.GetGroupsByStaticOpportunity(o, sCrit); //gL = o.GetGroups(sCrit);

I have tried both menthods to get the GroupList but both throw the same exception:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Exception from HRESULT: 0x800A03EC

I'm running SageACT Premuim 2013 (

I use this exact method so got ContactList from Opportunity and other types so I am not sure what is going on.
When debugging I see the the Opportunity object "o" has an opportunity which exists in the database and the debugger shows that the GetGroups and GetGroupsByStaticOpportunity methods are returning null values.

Any thoughts or help would be greatly appreciated.

Worst case I'll have to do this through some sort of SQL query which I would like to avoid if possible.

Thanks again in advance!

Copper Super Contributor
Posts: 52
Country: United_Kingdom

Re: Problem getting GroupList from Opportunity

Hi Eric,


This should point you in the right direction.


{ OpportunityList opps = oActFwk.Opportunities.GetOpportunities(null); foreach (Opportunity opp in opps) { GroupList groups = opp.GetGroups(null); foreach (Group group in groups) { MessageBox.Show("'" + opp.Name + "' is linked to the '" + group.Name + "' group."); } } } catch (Exception ex) { MessageBox.Show(ex.Message); }






Copper Contributor
Posts: 123
Country: Canada

Re: Problem getting GroupList from Opportunity

Hey thanks for the response.

I was having problems with this line of code:


GroupList groups = opp.GetGroups(null);

I thows the same exception as above as far as I remebmer.

What I did was just setup and SQL query to get a list of GroupID's using the OpportunityID as a parameter and then get get each group by ID.

It works as a work around but using a single line of code would be much more preferrable.

I'll try this again but I expect the same exception to be thrown. I'll report back once I have tried it.

Thanks again!