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

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
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
    Re: Inactivate a record in canvas app?

    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
    Re: Inactivate a record in canvas app?

    😳

     

    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

Coming soon: forum hierarchy changes

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

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 803 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 314 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 253 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics