Generated ID saves automatically

 Hi I’m using a counter  on Employee onboarding application While I click (ADD button) it  automatically Generated an Employee ID   I want to save when  I click the save button at that time only it will save   but  at the same time if I want to cancel  the auto generated Employee ID still  save but I don’t want to save when I click Cancel button  how to  overcome it  please help me
1 answers

Hi Rajat,

If you don’t need to display the employee ID beforehand, you can then simply commit the employee in a microflow. Prior to your commit activity, you have 2 options:

  1. Assuming you can delete employees, you can retrieve the employee with the highest value and increment it
  2. Assuming you will never delete employees, you can do a retrieve count and increment the count value

These methods ensure that you only take into consideration the committed employee entities. As a word of caution, this may have issues when you have multiple user and simultaneous transactions.

Alternatively, you can use the Autonumber attribute, but it will not roll the value back should you cancel the creation of the employee