Here is a handy little code snippet that shows how to determine if the currently selected group for an entity is an ad-hoc group or not.
GroupContext groupContext = Sage.SalesLogix.Client.GroupBuilder.GroupContext.GetGroupContext();
if ((groupContext.CurrentGroupInfo.CurrentGroup.GroupInformation.IsAdHoc) ?? false)
{//Do something because it is an adhoc group}
else
{//Do Something else here, because not adhoc}



