Creating a Unique ID from Power app before saving the item.

Scenario: Creating a unique ID befoere saving the item in Power Apps. This is a very small snippet but it works well and even survive the cache issue in powerapps. Put in the code in the OnSelect property of the button Set(randomLowest,1); Set(randomHighest,9999999); Set(varID, RoundDown(Rand()*(randomHighest -randomLowest +1)+randomLowest,0)) Put the below code on the default code of the input text Text(varEmpID,"0000000") Simple and sweet.