12-12-2017 03:19 AM
I need to do a kind of Opportunity lookup for opportunities of contact X.
How can i achieve this? I cannot add a 'relatedtocontactx' FilterCrierium like I do for the rest of the criteria:
CriteriaColumn col = ACTFM.Lookups.GetCriteriaColumn(descriptor); Criteria crit = new Criteria(LogicalOperator.And, 0, 0, col, OperatorEnum.Contains, value); crits.Add(crit); ... OpportunityLookup lookup = ACTFM.Lookups.LookupOpportunitiesReplace(crits.ToArray());
I can off course create a list of Guids with contact.GetOpportunities(null,null) and then do the lookup as above, and then loop through all matching opportunities and then foreach opportunity check if it's ID is in the list, but that's rather slow and ugly.
I think I have to achieve this with the parameters for contact.GetOpportunities (which I am now giving null), but how? I could not find this. It's asking an IFilterCriteria, and I have Criteria objects...
11 hours ago
Yes, this is still an issue. For now I've implemented the 'slow and ugly' method as described above, but I feel there has to be a more elegant way.
4 hours ago - last edited 3 hours ago
Unless I'm missing the scope of what you're doing, I would use GetOpportunitiesByContact() if it's available to you.
Yeah, just looking over this again, and I believe process is to get opportunities by contact method. (ACTFM.Opportunities.GetOpportunitiesByContact(Guid, IFilterCriteria)
Remember, the framework follows many of the examples of the base product. Act! doesn't have a Lookup Opportunities by Contact, so the framework won't as well. Instead you can get opportunities for a specified contact, or get contacts for a specified opportunity, but you cannot use an Opportunity Lookup to get that information.