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 / Inactivate a record in...
Power Apps
Answered

Inactivate a record in canvas app?

(0) ShareShare
ReportReport
Posted on by 664

I am trying to inactivate a record through PowerApps using the standard Status field:

 

Patch(
 Employees,
 LookUp(
 Employees,
 pre_employeeid = SelectedEmployee.EmployeeId,
 {statecode: 'Status (Employees)'.Inactive,
 statuscode: 'Status Reason (Employees)'.Inactive}
 )
);

 

When running this (through OnSelect of button), I get an error: "statecode: The specified column is generated by the server and can't be specified."

I am not sure if statuscode is required in the patch but added it so the code and reason would align. Is there a different way I should be going about inactivating a record through the app?

I have the same question (0)
  • Verified answer
    Hamish Sheild Profile Picture
    3,005 Most Valuable Professional on at

    Hi @Cooper01 ,

     

    I think you might have your brackets in the wrong place.  You have the statecode and status code inside the Lookup function.  Try the following

     

    Patch(
     Employees,
     LookUp(
     Employees,
     pre_employeeid = SelectedEmployee.EmployeeId),
     {statecode: 'Status (Employees)'.Inactive,
     statuscode: 'Status Reason (Employees)'.Inactive}
    );

     

  • Cooper01 Profile Picture
    664 on at

    😳

     

    Thank you. I did not need the Status Reason after fixing that, the update worked on statecode only

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 101 Most Valuable Professional

#2
Haque Profile Picture

Haque 81

#3
VASANTH KUMAR BALMADI Profile Picture

VASANTH KUMAR BALMADI 70

Last 30 days Overall leaderboard