web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set Date field based o...
Power Apps
Answered

Set Date field based on Status selection = Completed

(0) ShareShare
ReportReport
Posted on by 244

Hi all,

 

I have a Q&A form where the user submits a question. Default status is "Submitted". The site admins come to the new question and answer it. They change the status to "Completed" and I would like the "Date Completed" field to be populated with the current date. I had it working, but every time the form was opened, the Date Completed changed to the current date. It needs to not change again once the status has been set to Completed. I've tried ensuring that the function only runs when the Date Completed field IsBlank, but no luck. Not sure if I'm pointing to the wrong element or what. And of course, now that I've changed it, I forgot to record what worked partially and have not been able to get it back to even that point. 

 

Right now, I have the function set to run in the Status field's "On Change", so that when the status is changed, it will check the status value and whether the DateCompleted field is blank. If all conditions are met, it should set the variable "answeredDate" to Now().

Status On Change:

If(Self.Selected.Value = "Completed" & IsBlank(ThisItem.DateCompleted), Set(answeredDate, Now()))

 

[I've tried IsBlank(DataCardValue11.SelectedDate) as well with no better results]

 

DateCompleted date picker Default:

answeredDate

 

DateCompleted On Change (if the admin needs to change the Date Completed value manually, this should set the variable to the new date and then the default gets updated with the new value in the answeredDate variable, right?):

Set(answeredDate, Self.SelectedDate)

 

I would have thought something like this would be simple. I've been able to do it with other field types, but not with date. 

Again, I'm trying to make Date Completed set to the current date when the status = Completed, and NOT change again the next time the form is opened. 

Categories:
I have the same question (0)
  • CCJones Profile Picture
    244 on at

    I just can't get my head on straight today! It's if ThisItem.Status is NOT Completed! 

  • 00236123 Profile Picture
    71 on at

    I think that worked, 

    Will be checking tomorrow to ensure the dates don't change. I appreciate your help.

  • CCJones Profile Picture
    244 on at

    Forget that last. It wasn't if ThisItem.Status was empty, it was if it was Completed.

  • CCJones Profile Picture
    244 on at

    I did, but I wish I could say for certain how. The customer decided they didn't need the form and deleted the site it was on. And of course, I didn't record how I did it. Ugh. It was just a custom SharePoint form rather than a full blown app. I feel like the formula I used worked (shown in a previous response) but had to be modified so that "ThisItem.Status" had to be empty for it to trigger. That prevented later reset of the date to "Today()" when the form was opened again after completion. So basically something like:

    If((IsBlank(ThisItem.'Date Answered') || IsEmpty(ThisItem.'Date Answered')) && (And(StatusValue.Selected.Value = "Completed", IsBlank(ThisItem.Status))), Today(), ThisItem.'Date Answered')

    Sorry I don't have this somewhere that I can check it right now, but in my head it seems like it ought to work. 

  • 00236123 Profile Picture
    71 on at

    Hello @CCJones ,

     

    Were you able to find the solution for your issue. I am having the same issue. I need a Date DataCard to automatically fill out with the Toda() function based on a selected value of a Choice column. 

    I can make it work but the date disappears once someone goes back to the form.

     

    😞

     

  • CCJones Profile Picture
    244 on at

    Hi @WarrenBelz ,

    Thanks for checking back in!  It seems that at least I have the automation of the Date Answered field when the status is set to Completed working. The date does not change again after having been set once. The only continuing issue is the SharePoint List date showing a day behind while the date in the form shows correctly. I've tried changing the local time on the form to UTC, but that didn't help. Looks like there's a somewhat complicated (at least to me, not being a dev) formula to resolve it, but I can't tell where I'm supposed to plug the formulas in. 

     

    Anyway, that's not in scope for this question, so I may submit a new question to try to figure that part out.

     

    Thanks for your help!

  • WarrenBelz Profile Picture
    153,472 Most Valuable Professional on at

    Hi @CCJones ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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.

    Visit my blog Practical Power Apps

  • WarrenBelz Profile Picture
    153,472 Most Valuable Professional on at

    Hi @CCJones ,

    In answer to your two questions - the first one is fairly broad, but there is not a lot wrong with the concept of what you are doing - you just need to get your values and flow of changes correct. The Date issue is generally a difference between the time zone on the (I assume SharePoint) data source and the user's PC.

     

    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.

    Visit my blog Practical Power Apps

  • Verified answer
    CCJones Profile Picture
    244 on at

    Hi @WarrenBelz ,

     

    I found another question that helped me get the date updating here:

    Possible to update Date Field when Drop Down Value... - Power Platform Community (microsoft.com)

     

    I added it to the default for the Date Answered card and made a few modifications to it to have it only trigger when Status = Completed and the Date Completed value is empty.

    If((IsBlank(ThisItem.'Date Answered') || IsEmpty(ThisItem.'Date Answered')) && DataCardValue3.Selected.Value = "Completed", Today(), ThisItem.'Date Answered')

     

    Will check that tomorrow. I ran into another issue with it though. The date value that appears in the form is not the same as the date that appears in the SharePoint list view (List view displays the previous day).  I've seen a couple of questions about this issue as well, but the solutions are pretty confusing. 

  • CCJones Profile Picture
    244 on at

    Hi @WarrenBelz ,

    I'm not sure if something else could have been doing it or not. I decided I'd better wipe the entire thing and start fresh. I put just the code you show above in the OnChange for the Status choice selector and the variable "answeredDate" in the default for the DateCompleted card. It doesn't work, so it must have been something else that was setting the correct value. 

     

    If you were building something similar from the ground up, what direction would you go? 

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.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 400

#2
WarrenBelz Profile Picture

WarrenBelz 348 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 315 Super User 2025 Season 2

Last 30 days Overall leaderboard