I have a disabled textfield in a PowerApp, which needs to show the ID of the item the user is going to create through my PowerApp.
I have two lists on SharePoint.
The first list is called "ID Config". The list consists of a single element. This element contains an ID in a field called "Deviation_ID".
The second list contains Deviations. Deviations is created through the Power App, and the next-in-line Deviation_ID is assigned to the Deviation the user is creating.
Each time a user opens the Deviation screen in my PowerApp, the ID in ID Config is counted up, once, using this code on the "OnVisible" property:
If(Connection.Connected,
UpdateContext({DeviationID:Text(Value(First('ID Config').Deviation_ID+1),"00000")});
Patch(
'ID Config',
First('ID Config'),
{Deviation_ID:DeviationID}
), Select(Button2)
);
However, sometimes the ID fetched is being reset to "00001", instead of counting up once. Meaning the ID fetched from the list is just 0.
Am I missing something, that causes a fail when fetching the current ID from the ID Config list?