Skip to Content
avatar image
Former Member

Trying to Properly Loop through all Sales Team Parties

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 27, 2017 at 11:55 AM

    Hello Paul,

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

    HTH,
    Horst

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 30, 2017 at 04:25 PM

    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

    Add comment
    10|10000 characters needed characters exceeded