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 / Patch Date and Time bu...
Power Apps
Unanswered

Patch Date and Time but only if sharepoint column is blank

(0) ShareShare
ReportReport
Posted on by

Hi Experts,

 

Hopefully an easy one for you. 

 

I have an app and sharepoint list, in the sharepoint list there is a column called Response, when the user presses the submit button, it will patch some information into the record that has been selected. I want it to put the date and time now into the Response column but only if the Response column is blank, if it has a date and time already in it then I don't want it to be overwritten. Is that possible please? Below is my current snippet for patching that column

 

Patch(TicketingSystem, 
'Gallery-Tickets'.Selected, 

{
Status:'Dropdown_Status_1'.Selected.Value,
Response: Now(),

 

Thanks in advance,

Dave

Categories:
I have the same question (0)
  • StretchFredrik Profile Picture
    3,395 Super User 2025 Season 2 on at

    Try this:

     

    Patch(TicketingSystem, 
    'Gallery-Tickets'.Selected, 
    
    {
    Status:'Dropdown_Status_1'.Selected.Value,
    Response:If('Gallery-Tickets'.Selected.Response <>Blank(),Now())

     

  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @Dave-ITMan ,

    Yes, it is possible to patch the date and time into the Response column only if it is currently blank. You can use the If function to check if the Response column is blank before updating it. Here’s how you can modify your current snippet:

     

    Patch(
     TicketingSystem,
     'Gallery-Tickets'.Selected,
     {
     Status: 'Dropdown_Status_1'.Selected.Value,
     Response: If(IsBlank('Gallery-Tickets'.Selected.Response), Now(), 'Gallery-Tickets'.Selected.Response)
     }
    )

     

  • Dave-ITMan Profile Picture
    on at

    Hi @anandm08 ,

     

    Thanks for quick response, When that submits to sharepoint it is showing the time as 01:00pm but it should have been 01:02pm, do you know why it isn't giving me the correct minutes please? 

     

    Thank you

    Dave

  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    check you SharePoint site time zone may be it is not set to your local time zone

  • Dave-ITMan Profile Picture
    on at

    Hi @anandm08 

    It is the correct time zone, the default created column is showing correctly. If I put the Response column to friendly time, it's showing 12 hours ago so it's patching it as AM and not PM and not picking up the minutes. 

     

    I also have another bit of code in the patch which is below and the TicketReponses is showing the correct date and time in sharepoint

     

    Patch(TicketingSystem, 
    'Gallery-Tickets'.Selected, 
    
    {
    Status:'Dropdown_Status_1'.Selected.Value,
    Response: If(IsBlank('Gallery-Tickets'.Selected.Response), Now(), 'Gallery-Tickets'.Selected.Response),
    TicketResponses: User().FullName & " - " & Now() &":
    " & 'TextInput-Response'.Text & "
    " & Char(13)& 'Gallery-Tickets'.Selected.TicketResponses});
  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    @Dave-ITMan  try this code:

    Patch(
     TicketingSystem,
     'Gallery-Tickets'.Selected,
     {
     Status: 'Dropdown_Status_1'.Selected.Value,
     Response: If(IsBlank('Gallery-Tickets'.Selected.Response), Text(Now(), "[$-en-US]yyyy-mm-dd hh:mm:ss"), 'Gallery-Tickets'.Selected.Response)
     }
    )
  • Dave-ITMan Profile Picture
    on at

    Hi @anandm08 

     

    I'm getting the following error now:

     

    The type of this argument 'Response' does not match the expected type 'Date'. Found type 'Text'.

     

    Regards

     

    Dave

  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    try DateTimeValue(yourResponseResult)

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
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard