0

I have an entity Dancers that has a lookup to entity Level. The level is determined based on the hours that the dancer dances per week. Currently there are 4 levels (Level 1, Level 2, Level 3, Level 4)

I also have an entity called Routine. Once the user adds dancers from the Dancers table (N:N) to this routine, the field 'Routine Level' (also a lookup to the Levels entity) must be calculated based on the majority level of the related dancers.

I'm looking to get some guidance on how I might go about calculating the majority and then setting that Routine Level Lookup using Javascript.

Tor
  • 1
  • 1
  • How do you want to determine the majority? What if in the course of time the routine level of the majority changes? E.g. do you really want to compute Routine Level only when the number of hours a dancer dances per week changes? – Henk van Boeijen Oct 12 '21 at 07:47
  • Thank you for your reply! When they change the hours danced per week, right now their dancer level adjusts accordingly. I have used a cloud flow for this (for now). When the dancers division changes because of their hours being adjusted, the routine level should also adjust accordingly. So I want to change based on the related dancer's division lookup.... though open to any way of solving this to be honest. – Tor Oct 12 '21 at 18:32
  • So, why do you consider updating the routine level using JavaScript? It seems to me it is possible to do the updates by a cloud flow entirely. E.g. you could build a daily scheduled flow that updates all dancer records based on the result of an aggregate fetch xml. – Henk van Boeijen Oct 13 '21 at 08:46

0 Answers0