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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Safeguard Deleting Rec...
Power Apps
Answered

Safeguard Deleting Records - Getting Patch Error

(0) ShareShare
ReportReport
Posted on by 221

Hi,

      I have a gallery and at the end of each record I have a little trash can. What I tried to do is make the record inactive instead of it being deleted; however, I am getting an error. This is the patch formula that I used. Patch('[incentive_test].[D_eTime]',ThisItem,{'DELETE_IND':{Value:"Y"}})

The error that I am getting is saying the type of this argument 'Delete_IND does not match the expected type 'Text". Found type Record. 

 

Now for the DELETE_IND value I made the select "N" and "Y" with the DataCardValue13.Selected.Value

 

NitroPepsi_2-1663003167958.png

 

 

 

NitroPepsi_1-1663003140181.png

 

 

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NitroPepsi 

    This indicates what is says...the column is expected to be text, not a record.

     

    Please consider changing your Formula to the following:

    Patch('[incentive_test].[D_eTime]',
     {yourPK: ThisItem.yourPK,
     'DELETE_IND': "Y"
     }
    )

     

    Since you are using SQL, it is not going to have complex column types, so using {Value: "Y"} is a record that it will not understand.

     

    Also, when you patch, provide your Primary Key column.  That is ALL that patch needs and it will be more reliable to indicate the exact record to patch.

     

    I hope this is helpful for you.

  • NitroPepsi Profile Picture
    221 on at

    Worked like a charm! 

  • NitroPepsi Profile Picture
    221 on at

    Another question for you,

    Thank you for your responses, Another question for you, I also wanted to update who modified and the time. I tried putting this in but it did not like it. How can I get this to work? 

     

    Patch('[incentive_test].[D_eTime]', {ID: ThisItem.ID, 'DELETE_IND': "Y" },

    {ID:ThisItem.ID,MODIFY_USER:User().Email},
    {ID: ThisItem.ID, MODIFY_TIMESTAMP: Now()}))

  • NitroPepsi Profile Picture
    221 on at

    Update, does this seem correct? 

    Patch('[incentive_test].[D_eTime]', {ID: ThisItem.ID, 'DELETE_IND': "Y"}, {ID: ThisItem.ID, MODIFY_USER: User().Email},{ID: ThisItem.ID, MODIFY_TIMESTAMP: Now()})

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NitroPepsi 

    No, you would only need to specify the record you want to patch.  That is multiple records!

    So the formula would be:

    Patch('[incentive_test].[D_eTime]', 
     {ID: ThisItem.ID, 
     'DELETE_IND': "Y",
     MODIFY_USER: User().Email,
     MODIFY_TIMESTAMP: Now()
     }
    )
  • NitroPepsi Profile Picture
    221 on at

    Thank you so much! It worked.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NitroPepsi 

    No Problem!!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 337 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard