Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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

  • anandm08 Profile Picture
    1,936 Super User 2025 Season 1 on at
    Re: Patch Date and Time but only if sharepoint column is blank

    try DateTimeValue(yourResponseResult)

  • Dave-ITMan Profile Picture
    on at
    Re: Patch Date and Time but only if sharepoint column is blank

    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 2025 Season 1 on at
    Re: Patch Date and Time but only if sharepoint column is blank

    @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
    Re: Patch Date and Time but only if sharepoint column is blank

    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 2025 Season 1 on at
    Re: Patch Date and Time but only if sharepoint column is blank

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

  • Dave-ITMan Profile Picture
    on at
    Re: Patch Date and Time but only if sharepoint column is blank

    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 2025 Season 1 on at
    Re: Patch Date and Time but only if sharepoint column is blank

    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)
     }
    )

     

  • StretchFredrik Profile Picture
    2,628 Super User 2025 Season 1 on at
    Re: Patch Date and Time but only if sharepoint column is blank

    Try this:

     

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

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,618 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,957 Most Valuable Professional

Leaderboard