Skip to Content
0

Trying to Properly Loop through all Sales Team Parties

Jan 26, 2017 at 09:19 PM

37

avatar image

Hello,

I'm currently trying to loop through all Sales Team Parties in my Opportunity, so I can assign a user with a specific role to a new field. We're going to have 7 roles and a field for each, so I imagine using a Switch Case once I have it setup properly to get them all assigned properly, but I can't figure out how to get all of the Sales Team Parties.

Using this code is working well so far:

var First = this.SalesTeamParty.GetFirst();
var FirstRC = First.RoleCode;

That is giving me the RoleCode that I need to use in my Switch Case to assign that user to the correct new field that will be created. However, the problem that I'm encountering is that if I have 3 parties, I'm only able to obviously get the first one, is there an easy way to get them all and loop through them one at a time, it seems like the only option that I might have would be doing a "Where()" but I haven't succeeded in setting up a filter that works. If anybody could help me out with this, I would greatly appreciate it.

Thanks,
Paul

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Horst Schaude
Jan 27, 2017 at 11:55 AM
0

Hello Paul,

Please have a look at the documentation at section 7.2.4.12 Collection Handling (Business Logic)

HTH,
Horst

Share
10 |10000 characters needed characters left characters exceeded
Paul Kates Jan 30, 2017 at 04:25 PM
0

Hey Horst,

I looked through the documentation and was able to use the OrderBy filter...

var RoleCodes = this.SalesTeamParty.OrderBy(n=>n.RoleCode);

This was giving me all the RoleCodes for that Opportunity.

Thank you very much for pointing me in that direction, it was just what i needed.

Thanks,
Paul

Share
10 |10000 characters needed characters left characters exceeded