in my Power app I save data into collection before sending it to flow.
One of the attributes is ProductID.
I have a condition saying that if the user picks a custom product (i.e. not from our Product list), the ProductID shall be saved as GUID("00000000-0000-0000-0000-000000000000")
Otherwise it saves existing ProductID of the chosen product (from our Product list) from a dropdown- see the pic
What occasionally happens is that in the true part of the condition, the ProductID SOMETIMES is saves as null insted of GUID("00000000-0000-0000-0000-000000000000") - see te pic (the input into flow)
It isn´t happening consistently every time when custom product is used, only occasionally, which really annoys me.
Can anyone help me understand why?
In the app, I took care of it with a validation condition so it is prevented from getting into the flow now, but I would like to know how such thing can happen...
Thanks a lot
It’s possible there’s some other code affecting your collection which is clearing your stored GUID.
One thought is the use of the Update() function. This will clear a record and replace it with data you specify. Are you using this function?
I’d also be looking at other code that affects your collection as well. Difficult to say without seeing your app processes and code that affects this issue
Thanks for you answer @EddieE
Well, I´ll try to describe how I work with the collection:
1) Users create some data (using combo boxes and textinputs), click on a button = create the collection (using Collect) - one of the collumns is Status, in this phase the record gets created with Status = IsDraft
2) Users check and confirm the records (they can edit/delete each record) and move to the next screen using a button = each confirmed record gets Status = Confirmed (using Patch(MyCollection),...)
3) On the next screen the confirmed collection is then put into JSON format and sent into flow using a button
That´s pretty much everything I do with the data.
Where do you suggest to add the Update, it doesn´t make much sense in my scenario, I think..
Thanks a lot
You are correct, there’s no need for you to use Update. I was just checking if you used it in your code and offered this as a check on where your processes may need to be looked at.
Reading through your process I stick by my original comments ie that there’s some code or process affecting the GUID value.
When I hear things like ‘… it doesn’t happen all the time …’ it says to me that there are 2 or more competing pieces of code - somewhere - that are affecting the data, and the difficult part is to try and find them. I’d start by looking in the edit/delete phase 2 and in behaviour formulas ie OnChange, OnSelect, OnVisible, etc. Play around with how users ‘could’ edit/delete because they will always do unexpected things and in ways you wouldn’t imagine. Find these and stop them doing it.
You could also look for double-click events. In my experience, users can sometimes double-click buttons/icons causing code to run twice with unexpected data outcomes. I also avoid OnSelect events on labels as I’ve found these can cause many double-click events.
You could also look at phase 1, where you use Collect. Anywhere I use Collect into collections in my apps I always have check code that ensures the collection only gets 1 record. This ensures the collection only ever gets data I know is correct. You could look at this as well. Pseudo code for a check like this when clicking on a gallery could look like
If( CountRows( Filter( myCol, ID=ThisItem.ID)) = 0, Collect( myCol, ThisItem)
Hopefully this makes sense and gives you some tips of where you could start looking for answers?
Keep up to date with current events and community announcements in the Power Apps community.
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
Check out the latest Community Blog from the community!