• Maher AJAMANE
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hello everybody and especially sports lovers out there!

One of our clients is actually a major sports league in France! and at the moment, we're developping a system based on salesforce to manage all the teams, matches, statistics... etc. So here's my question:

I'm creating a batch that launches every week. this batch must update a player statistics (points, red cards, subtitutions...etc) per competition. the data is taken from a custom object called "composition equipe" that has all the data related to the player and then we must put the data per player AND per competition in a new custom object called "statistique joueur competition" (joueur= player) 

To furthur explain, here's a scenario:

Let's say a player Mike scores 3 points today and 4 points next week in a competition called "league". The same Mike also scores 2 points today and 3 next week in a competition called "friendly match"

In the end, we must have in our new object "statistique joueur competition" the following records: "Mike League. 7 points" and "Mike freindly match. 5 points"

so my trouble is to find the key that combines the player and the competition together. I tried nested queries but the system only allows 2 levels of queries and there are 4 levels between my objects.

Here's a quick topology of the objects in question:

Player= contact
Parent child relationships between objects: Competition -> Match -> Composition -> Composition Equipe

I hope that it's clear for everybody. if it's not, I'd be happy to explain furthur more.

I'm also new to coding by the way!

Thanks a lot for your help :)