cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver III
Resolver III

Inactivate a record in canvas app?

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

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

 

View solution in original post

2 REPLIES 2
Highlighted
Super User II
Super User II

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

 

View solution in original post

Highlighted
Resolver III
Resolver III

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

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (7,885)