Blog

Main » 2021 » August » 11

Problem: a random user should be selected from a queue to assign a lead. The number of users in the queue is unknown and calculated on the go (variable UserCount).

Implications: multiple records may enter the flow at the same time, so the random number should be generated for those (and the timestamp can't be used to generate the random number).

Solution: Use date with the combination with data that came with a record to generate a random number. The seed (the starting number to generate a random(~er) number) is a concatenation of date and length of the Lead Name (variable getLead.Name)

Implication: we don't know the span of a random number (max and min), so, we can't normalize the output.
Solution: use last digit of the random number -> this normalizes the span [0-9]

Final solution:


ROUND(value(Right(text(ROUND(sqrt(
(value(
 (left(right(text(now()),6),2)
		
		... 
		
			Read more »