Announcements
I have a form with 2 Date fields, DateSubmitted and DateRequired. I have a SharePoint backend with a choice field of "Priority" and the choices are "Emergency" and "Normal". I want the Priority field to autopop to Emergency if the DateRequired field is < 3 days from the DateSubmitted field. Any help would be appreciated!
Hi @BadCode ,
The DefaultSelectedItems (I assume this is a Combo Box) would be
{ Value: If( DateDiff( ThisItem.DateSubmitted, ThisItem.DateRequired, TimeUnit.Days ) < 3, "Emergency", "Normal" ) }
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
Thanks @WarrenBelz
Now it is always on Emergency.
It works when viewing a created form. When I'm in a new form it stays on Emergency. If I submit form and return to it, it will show correctly.
Is there a way to have it update when the DateRequired is selected?
@BadCode ,
Just do it on FormMode
{ Value: If( YourFormName.Mode = FormMode.New, If( DateDiff( ThisItem.DateSubmitted, ThisItem.DateRequired, TimeUnit.Days ) < 3, "Emergency", "Normal" ), ThisItem.Priority.Value ) }
@BadCode I think there are more details that need to be checked but for your question set DefaultSelectedItems to
{Value:If(DateDiff(DataCardValue5.SelectedDate, // datepicker in DateSubmitted_DataCardDataCardValue6.SelectedDate, // datepicker in DateSelected_DataCardTimeUnit.Days) < 3,"Emergency","Normal")}would work I guess.
@zeg ,
Not sure why you repeated my first post . . .
@WarrenBelz I didn't.Your post(s including the second) is/are using "ThisItem" that I would usually use in edit or view mode.
Mine is pointing at the controls in all modes.
Same thing really, but I generally do not come in on posts under discussion unless they are not heading in the right direction - up to you but I would extend you the same courtesy.
Not really @WarrenBelz .
I'm new here so I'd like to ask. Does courtesy in your "Same thing really, but I generally do not come in on posts under discussion unless they are not heading in the right direction - up to you but I would extend you the same courtesy." means that I should have waited for you to figure it out?
And by the way, your first and second posts still don't look like they are 100% answers to the question.
I am here to help when I can without any other intensions so I'm still not sure I understand what really bothered you.
Hi @WarrenBelz
Unfortunately this one does not update or show the correct Priority when returning to the record, always shows Emergency no matter what date is set. Also wanted to note that I added a ")" after "ThisItem.Priority.Value" to fix the forgotten ")".
Is it common to feel dumber the more PowerApps I learn? 🙂
I appreciate all the help, it's not the first time you've assisted me! I will get back to this tomorrow morning, it's past midnight here and I've been racking my brain all day. Btw, love your blog!!!
We will leave it there as I do not want to continue the discussion on this thread, but regular responders will appreciate my thoughts.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 409 Super User 2026 Season 2
Mohsin Ali 328
WarrenBelz 252 Most Valuable Professional